To make things clear, I will describe in
more detail about what we encountered in the past a few weeks.
About 2-3 weeks ago, we tried out the Ads API, here were what we could and could not do -
- Get the list of Ads accounts that have granted access to NetBase account (OK)
- Get Ads account detail informaiton (OK)
- Get Ads account permission (OK)
- Get campaign lists (OK)
- Get list of tailored audiences (OK)
- Create a new tailored audience (NOT OK with UNAUTHORIZED_CLIENT_APPLICATION exception)
- Link the uploaded audience file( uploaded through TON API) with existing tailored audience (NOT OK with UNAUTHORIZED_CLIENT_APPLICATION exception)
We escalated this problem to twitter about 1 week ago, then Twitter helped made some configuration changes to our application. Unfortunately, after that configuration changes, what used to work stopped working -
- Get the list of Ads accounts that have granted access to NetBase account (OK)
- Get Ads account detail information (OK)
- Get Ads account permission (OK)
- Get campaign lists (NOT OK with UNAUTHORIZED_CLIENT_APPLICATION exception)
- Get list of tailored audiences (NOT OK with UNAUTHORIZED_CLIENT_APPLICATION exception)
- Create a new tailored audience (NOT OK with UNAUTHORIZED_CLIENT_APPLICATION exception)
- Link the uploaded audience file( uploaded through TON API) with existing tailored audience (NOT OK with UNAUTHORIZED_CLIENT_APPLICATION exception)
As you can see, it is worse than before the application configuration change.
Below are the steps that we tried after the configuration change. Please not that these were directly using Twitter’s twurl, instead of our implementation.
I am using my account to do the test (My twitter Ads account id is 18ce53yytmv).
1: grand access to NetBase application as Ad Manager.
2: install twurl and authorize with NetBase consumer-key and consumer-secret
> twurl authorize --consumer-key key --consumer-secret secret
> Sign in to the URL generated by the previous command using NetBase Account, and input the generated PIN number.
> Authentication Complete.
3: call get account lists, API> twurl -t -H ads-api.twitter.com /0/accounts | python -m json.tool
We can get a list of accounts that have granted access to NetBase.
{
“approval_status”: “ACCEPTED”,
“created_at”: “2015-04-29T02:18:14Z”,
“deleted”: false,
“id”: “18ce53yytmv”,
“name”: “Eric”,
“salt”: “81ebb6cdc775ea7633e81da8baf635c8”,
“timezone”: “America/Los_Angeles”,
“timezone_switch_at”: “2015-04-28T07:00:00Z”,
“updated_at”: “2015-04-29T06:37:06Z”
}
4: call get account detailed information, API> twurl -t -H ads-api.twitter.com /0/accounts/18ce53yytmv | python -m json.tool
{
“data”: {
“approval_status”: “ACCEPTED”,
“created_at”: “2015-04-29T02:18:14Z”,
“deleted”: false,
“id”: “18ce53yytmv”,
“name”: “Eric”,
“salt”: “81ebb6cdc775ea7633e81da8baf635c8”,
“timezone”: “America/Los_Angeles”,
“timezone_switch_at”: “2015-04-28T07:00:00Z”,
“updated_at”: “2015-04-29T06:37:06Z”
},
“data_type”: “account”,
“request”: {
“params”: {
“account_id”: “18ce53yytmv”
}
}
}
5: call get account permissions information, API> twurl -t -H ads-api.twitter.com /0/accounts/18ce53yytmv/authenticated_user_access | python -m json.tool
{
“data”: {
“permissions”: [
“AD_MANAGER”
],
“user_id”: 39596342
},
“data_type”: “user_access”,
“request”: {
“params”: {
“account_id”: “18ce53yytmv”
}
}
}
6: call get account campaigns list, API> twurl -t -H ads-api.twitter.com /0/accounts/18ce53yytmv/campaigns | python -m json.tool
{
“errors”: [
{
“code”: “UNAUTHORIZED_CLIENT_APPLICATION”,
“message”: “The client application making this request does not have access to this API”
}
],
“request”: {
“params”: {}
}
}
7: call get account tailored audience list, API> twurl -t -H ads-api.twitter.com /0/accounts/18ce53yytmv/tailored_audiences | python -m json.tool
{
“errors”: [
{
“code”: “UNAUTHORIZED_CLIENT_APPLICATION”,
“message”: “The client application making this request does not have access to this API”
}
],
“request”: {
“params”: {}
}
}
Exception Examples:
C:\Users\elin>twurl -t -H ads-api.twitter.com /0/accounts/18ce53yytmv/tailored_audiences | python -m json.tool
opening connection to ads-api.twitter.com:443…
opened
starting SSL for ads-api.twitter.com:443…
SSL established
<- “GET /0/accounts/18ce53yytmv/tailored_audiences HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: /\r\nUs
er-Agent: OAuth gem v0.4.7\r\nContent-Type: application/x-www-form-urlencoded\r\nAuthorization: OAuth oauth_consumer_key=“aA1WEjRu4Oa6lKQDR
P2I1WLNo”, oauth_nonce=“6Kajp8VLYdrOkf6syx1BdamcUWFzqc4GxUvZ6rU3OA”, oauth_signature=“ixx2O0O90roenRz5NBpTvu2LZZo%3D”, oauth_signature_
method=“HMAC-SHA1”, oauth_timestamp=“1433495810”, oauth_token=“39596342-2X0I4qZQQHSq0ZDurZU8bTxDf7ByGNbRf2XAISdag”, oauth_version=“1.
0”\r\nConnection: close\r\nHost: ads-api.twitter.com\r\nContent-Length: 0\r\n\r\n”
<- “”
-> “HTTP/1.1 403 Forbidden\r\n”
-> “connection: close\r\n”
-> “content-disposition: attachment; filename=json.json\r\n”
-> “content-encoding: gzip\r\n”
-> “content-length: 166\r\n”
-> “content-type: application/json;charset=utf-8\r\n”
-> “date: Fri, 05 Jun 2015 09:16:49 GMT\r\n”
-> “server: tsa_k\r\n”
-> “set-cookie: guest_id=v1%3A143349580980242679; Domain=.twitter.com; Path=/; Expires=Sun, 04-Jun-2017 09:16:49 UTC\r\n”
-> “strict-transport-security: max-age=631138519\r\n”
-> “x-access-level: read-write-directmessages\r\n”
-> “x-connection-hash: 1801e3f18ed2eed0a2e11e723ffc2a6c\r\n”
-> “x-content-type-options: nosniff\r\n”
-> “x-frame-options: SAMEORIGIN\r\n”
-> “x-rate-limit-limit: 2000\r\n”
-> “x-rate-limit-remaining: 1989\r\n”
-> “x-rate-limit-reset: 1433495905\r\n”
-> “x-response-time: 222\r\n”
-> “x-runtime: 0.009011\r\n”
-> “x-transaction: c974a8f0e54800a0\r\n”
-> “x-xss-protection: 1; mode=block\r\n”
-> "\r\n"
reading 166 bytes…
-> “”
-> "\x1F\x8B\b\x00\x00\x00\x00\x00\x00\x00,\xCEA\n\x830\x10@\xD1\xAB\f\xB3\xF6\x04\xEE\x82\x15\x1A\x10\x95\x127-E\x868h\xA8&6I\xBB\t\xB9{-\x
ED\xFE\xF1\xF9\t\xD9{\xE7\x03\x96\xB7\x84\xDAM\x8C%\x0E\xAD\x18\xD4\xB9\xBB\xC8k}\x1A\xABF\xD6\xAD\x1AE\xDF7\xB2\x12Jv-\x16\xB8q\b4\x7F\xADZ
\x18\xF4j\xD8F\xA0}_\x8D\xA6h\x9C\x85\x8D\x1E\xC6\xCE\x10\x17\x13\xC0\xF3\xF3\xC5!\xC2\xE48\x80u\x11\x16z3\x90\xD6G\x04\xA2\xFB!\xD1K\xCC\xF
7\x02\xFF\x18\xCB\x84;y\xDA\x8E\xB1\x94s\xFE\x00\x00\x00\xFF\xFF\x03\x00\xD8sZ\xFD\xA7\x00\x00\x00"
read 166 bytes
Conn close
{
“errors”: [
{
“code”: “UNAUTHORIZED_CLIENT_APPLICATION”,
“message”: “The client application making this request does not have access to this API”
}
],
“request”: {
“params”: {}
}
}