Hello,
My application was approved for developer access but I get a 400 error when I try to use the TON API.
My application ID is 8649882. I have ADS API - Developer Access and it was granted on 4/20/2016.
I’m using the CodeBird PHP Framework for Twitter found here GitHub - jublo/codebird-php: Easy access to the Twitter REST API, Direct Messages API, Account Activity API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.
According to the documentation to make a TON API upload you do this:
`<?php
require_once ‘…/…/lib/config.php’;
//include twitter library
require_once (RESOURCE_DIR.‘/twitter/vendor/jublonet/codebird-php/src/codebird.php’);
\Codebird\Codebird::setConsumerKey(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET);
$cb = \Codebird\Codebird::getInstance();
//start upload
//single-chunk upload
$cb->setToken(‘redacted on purpose’,‘redacted on purpose’);
// single-chunk upload
$reply = $cb->ton_bucket_BUCKET([
‘bucket’ => ‘ta_partner’,
‘Content-Type’ => ‘text/csv’,
‘Content-Length’ => filesize(‘data.csv’),
‘file’ => ‘data.csv’,
‘X-TON-Expires’ => date(‘r’, strtotime(‘+7 day’))
]);
print_r($reply);
$target = $reply->Location;`
However this is the response I’m getting:
`stdClass Object
(
[httpstatus] => 400
[rate] => stdClass Object
(
[limit] => 50
[remaining] => 49
[reset] => 1465833623
)
)`
Any help would be greatly appreciated.
Thank you
Hi @kduncan7,
Can you take a look at this guide to 403s?
There should of been an error code explaining why you got the 403. That link above also links to a guide of the error codes.
Best,
Carmen
Did you resolve this issue? Please note as a heads up that there is a PHP SDK recently released for Twitter Ads API from another of our community members here and it would be great to see the support for TON API to be included in a PHP SDK somewhere 
Hi all,
I’m the developer of the Twitter ads phone ask.
I have this feature in schedule, but I didn’t find time to implement it yet. You can dm me and we can talk and work together if you want.
Thanks!!
Well,
Blackburn29 who colaborated with me in my library is creator of that library
I’ve also implemented it in my library. Mine is a library where you can use it as an SDK
Take a look:
This is very neat. Thanks again for all the help. I hope this helps others.