Creating accounts on the sandbox

api

#1

Hello hello,

We’re developing a test suite for an app that uses the ads API to create and manage campaigns, via the sandbox, but we hit a snag when trying to create a second account logged in as our test user. We still have the default sandbox account ready and useable, but any attempts to use the post /1/accounts/ endpoint to create an extra account will result in this:

Exception: #<TwitterAds::ServerError:0x75610680 code=500 details="[{:code=>"INTERNAL_ERROR", :message=>"Internal Error"}]">

Not sure what we’re doing wrong, but even passing the same params (just a name, really) as the ones used on the docs’ example, we still get the same error. Any thoughts on what’s wrong, and if this is something fixable on our end?

Thanks in advance!


#2

Can you confirm that you are hitting ads-api-sandbox.twitter.com instead of ads-api.twitter.com? Otherwise, it would be great if you can post a twurl repro so that I can be sure I am reproing it the same way you are.

Thanks,

John


#3

Hello!

Yes, I can confirm I’m hitting ads-api-sandbox - if I hit the regular ads api domain, I get a METHOD_NOT_ALLOWED status error.

I can repro the problem by authorizing twurl using the account’s username and password and our app’s token and secret, and then running:
twurl -X POST -H "ads-api-sandbox.twitter.com" /1/accounts
which, as always, results in
{"errors":[{"code":"INTERNAL_ERROR","message":"Internal Error"}],"request":{"params":{}}}

Any clue to what we’re doing wrong?


#4

I have the same problem. :confused:


#5

This is definitely a strange one, I’m trying to think of what might be wrong but here are some things to try:

  1. update the twurl version
  2. try checking shell environment like ruby version
  3. try from a diff machine / OS (I know it’s a pain to request to do this)
  4. try using twurl to hit REST API
  5. try a different endpoint than just /accounts, or try putting it in quotes

The exact command you did works for me, so it is either environment or app/authorization related:

twurl -X POST -H “ads-api-sandbox.twitter.com” /1/accounts
{“data_type”:“account”,“data”:{“name”:“Sandbox account for @JBabichJapan”,"t…