Hi guys,
1) I’m trying to create tailored audiences through API and then populate them also through API with PHP. I’m using Twitter Oauth PHP library by Abraham.
To initialize object, I’m using following keys:
'consumer_key' => 's9eoznsaLE0GZlqJh77HsFemO',
'consumer_secret' => hidden,
'access_token' => '2515659416-J7ZyTPeHVm3NeyFXmxFKyoWXMsuS7czU8ew4KoH',
'access_secret' => hidden
And to fetch all tailored audiences associated with that account, I use following:
->get('accounts/correct_acc_id/tailored_audiences');
where correct_acc_id is indeed correct account id and host is https://ads-api.twitter.com/0/
And response is UNAUTHORIZED_CLIENT_APPLICATION. Went to https://dev.twitter.com/form/ads-api-access-developer and applied. Upon submitting form, page was white and there was no mentioning about how long it usually takes, what should I do next, etc. Page was just blank white. ( As a web dev I find this very unprofessional ) Can anyone answer me those questions?
2) Ok, in the meantime while you are ( hopefully ) checking ( ? ) my app that I submitted, I thought I will try to upload something to your TON API with bucket ta_partner. Guess what? Yeap, again problems.
This is how I tried to upload.
Same object initializing as in 1). then post:
POST /1.1/ton/bucket/ta_partner.json HTTP/1.1
Host: ton.twitter.com
User-Agent: TwitterOAuth v0.2.0-beta2
Accept: /
Content-Type: text/plain
X-TON-Expires: Thu, 03 Dec 2015 09:55:33 GMT
Content-Length: 294
and as POST in BODY there are all required parameters:
data=aa%40aa.com&oauth_consumer_key=xxx&oauth_nonce=xxxx&oauth_signature=xxxxx&oauth_signature_method=HMAC-SHA1&oauth_timestamp=xxxxxx&oauth_token=zzzzz&oauth_version=1.0
I didn’t find nowhere where should I add those signatures, required keys, etc. Is it OK if they are in the body or should ( must? ) they be in the HEADER as Authorization:?
Response for above is:
* upload completely sent off: 294 out of 294 bytes
< HTTP/1.1 403 Forbidden
< content-length: 0
< date: Thu, 26 Nov 2015 09:55:33 GMT
< server: tsa_b
< set-cookie: guest_id=guest_id; Domain=.twitter.com; Path=/; Expires=Sat, 25-Nov-2017 09:55:33 UTC
< strict-transport-security: max-age=631138519
< x-connection-hash: some_hash
< x-content-type-options: nosniff
< x-response-time: 3
< x-tsa-request-body-time: 1
<
* Connection #0 to host ton.twitter.com left intact
Is it because I must set Authorization header or there is another issue?
Really looking forward to any answers/comments, because I recently did exactly same thing ( create and then populated custom audiences through API ) for other social media website and I didn’t encounter absolutely any problems.
Thanks.