-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A minimum of 1 items must be provided for categories #136
Comments
Looks like this error may be returned when the placement for a line_item is set to |
Thanks, @josephtyler! I was just going to open an issue for this exact thing. Repro: >>> from twitter_ads.client import Client
>>> from twitter_ads.campaign import LineItem
>>> ...
>>> client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
>>> account = client.accounts(ACCOUNT_ID)
>>> line_item = LineItem(account).load(account, 'a7bs8')
>>> line_item.name
u'Untitled'
>>> line_item.name = 'add a name'
>>> line_item.save()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jshishido/.virtualenvs/adsapi/lib/python2.7/site-packages/twitter_ads/resource.py", line 200, in save
resource, params=self.to_params()).perform()
File "/Users/jshishido/.virtualenvs/adsapi/lib/python2.7/site-packages/twitter_ads/http.py", line 72, in perform
raise Error.from_response(response)
twitter_ads.error.BadRequest: <BadRequest object at 0x10f091690 code=400 details=[{u'message': u'A minimum of 1 items must be provided for categories', u'code': u'INVALID_PARAMETER', u'parameter': u'categories'}]> Looks like this happens because we send all of the line item attributes in the update request and response = Request(
self.account.client, method,
resource, params=self.to_params()).perform() (Note: this is using twitter-ads 1.2.2, which hasn't yet been updated for v2, which is why we see >>> line_item.to_params()
{
'bid_type':u'MAX',
'name':'add a name',
'bid_amount_local_micro':10000000,
'created_at': u'2017-10-21T15:57:13Z',
'campaign_id':u'9qpme',
'bid_unit':u'ENGAGEMENT',
'updated_at': u'2017-10-21T16:45:43Z',
'paused':'true',
'charge_by':u'ENGAGEMENT',
'optimization':u'DEFAULT',
'placements':'TWITTER_TIMELINE',
'objective':u'TWEET_ENGAGEMENTS',
'product_type':u'PROMOTED_TWEETS',
'include_sentiment':u'POSITIVE_ONLY',
'id':u'a7bs8',
'categories':''
} cc: @jbabichjapan, @tushdante |
Looks like #119 attempts to address this. |
When updating a line item, I see a response from the like the following:
Are categories actually required to update a bid on a line item? If this isn't a bug, is there some documentation surrounding this? It appears that categories are not required to be set when working in the web app.
The text was updated successfully, but these errors were encountered: