Sandbox account not automatically created in API v1

faq

#1

A small thing, but according to the docs “When making an initial request to GET accounts in the sandbox, an account record will be generated for you from which you can perform the remainder of your operations.” This doesn’t happen with Ads API version 1.0, but does still work if you make the same call with v0 (so that’s an easy workaround if you are too lazy to create an account manually).


#2

Hello @tharlinsmith

Thank you for notifying our team about this issue! Our documentation needs to be updated to reflect the change in behavior for the Ads API Sandbox v1 endpoints. Whereas the v0 API sandbox would return an account_id after performing a GET on the /0/accounts/ endpoint, the behavior for this has been modified for v1.

For v1:

  • Perform a POST request on /1/accounts/ endpoint to create a new advertiser account, and the response from this request will contain an account_id that you can use for making all subsequent requests
  • The reason for this change in behavior is to allow sandbox users to create multiple advertiser accounts, if necessary.

A quick example below:

twurl -X POST -H "ads-api-sandbox.twitter.com" "/1/accounts/" | jq .

{ "data_type": "account", "data": { "name": "Sandbox account for <user>", "timezone": "America/Los_Angeles", "timezone_switch_at": null, "id": "gq131y", "created_at": "2016-08-11T19:13:10Z", "salt": "fca53e77ac4e160a57fbf3d45cc39aee", "updated_at": "2016-08-11T19:13:10Z", "approval_status": "ACCEPTED", "deleted": false }, "request": { "params": {} } }

I hope that answers your question!


#3

Hello,
My App ID is 12213799
When i perform a a POST request on /1/accounts/ endpoint, i have a METHOD_NOT_ALLOWED message as you can see below :
HTTP/1.1 100 Continue
HTTP/1.1 405
Method Not Allowed content-disposition:
attachment;filename=json.json content-length:
103content-type: application/json;charset=utf-8 date:
Thu, 18 Aug 2016 08:22:59 GMTserver: tsa_f set-cookie:
guest_id=v1%3A147150857897229546;Domain=.twitter.com;Path=/;Expires=Sat,
18-Aug-2018 08:22:58 UTCstrict-transport-security:
max-age=631138519
x-access-level: read-write-directmessagesx-api-version:
1.0x-connection-hash:
46238c10075aeb5e0497ef74f36d7f5ax-content-type-options:
nosniffx-frame-options: SAMEORIGINx-response-time:
96x-runtime: 4.91E-4 x-transaction:
00d52b8d00aa05b9x-xss-protection: 1;mode=block
{“errors”:[{“code”:“METHOD_NOT_ALLOWED”,“message”:“Method
POST not allowed.”}],“request”:{“params”:{}}}
Could you help me on this issue ?


#4

I believe this has been resolved in a separate thread AdsAPIv1 creation account issue on POST https://ads-api.twitter.com/1/accounts/


#5

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.