Skip to content

Commit fd3b0fe

Browse files
committed
Support Ads API
Fix #120.
1 parent d5c79b3 commit fd3b0fe

File tree

3 files changed

+423
-14
lines changed

3 files changed

+423
-14
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ codebird-php - changelog
1212
+ #129 Allow to change remote media download timeout
1313
+ #144 Support Collections API
1414
+ #145 Support TON API
15+
+ #120 Support Ads API
1516

1617
2.7.2 (2015-09-23)
1718
- #135 Invalid HTTP request headers in non-cURL mode

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,3 +780,45 @@ while (! feof($fp)) {
780780

781781
fclose($fp);
782782
```
783+
784+
### …access the Twitter Ads API?
785+
786+
The [Twitter Ads API](https://dev.twitter.com/ads/overview) allows partners to
787+
integrate with the Twitter advertising platform in their own advertising solutions.
788+
Selected partners have the ability to create custom tools to manage and execute
789+
Twitter Ad campaigns.
790+
791+
When accessing the Ads API or Ads Sandbox API, access it by prefixing your call
792+
with `ads_`. Watch out for the usual replacements for in-url parameters,
793+
particularly `:account_id`.
794+
795+
**Tip:** For accessing the Ads Sandbox API, use the `ads_sandbox_` prefix,
796+
like shown further down.
797+
798+
Here is an example for calling the Twitter Ads API:
799+
800+
```php
801+
$reply = $cb->ads_accounts_ACCOUNT_ID_cards_appDownload([
802+
'account_id' => '123456789',
803+
'name' => 'Test',
804+
'app_country_code' => 'DE'
805+
]);
806+
```
807+
808+
#### Multiple-method API calls
809+
810+
In the Twitter Ads API, there are multiple methods that can be reached by
811+
HTTP `GET`, `POST`, `PUT` and/or `DELETE`. While Codebird does its best to guess
812+
which HTTP verb you’ll want to use, it’s the safest bet to give a hint yourself,
813+
like this:
814+
815+
```php
816+
$reply = $cb->ads_sandbox_accounts_ACCOUNT_ID_cards_imageConversation_CARD_ID([
817+
'httpmethod' => 'DELETE',
818+
'account_id' => '123456789',
819+
'card_id' => '2468013579'
820+
]);
821+
```
822+
823+
Codebird will remove the `httpmethod` parameter from the parameters list automatically,
824+
and set the corresponding HTTP verb.

0 commit comments

Comments
 (0)