2. Twitter Ads APIをPostmanで試しに叩いてみる方法
Postmanで「Twitter Ads API」をフォーク
以下のURLにアクセスし、「Twitter Ads API」コレクションをフォークします。
![](https://assets.st-note.com/img/1649829847303-ZsT4DoKXcf.png?width=1200)
![](https://assets.st-note.com/img/1649829855874-kjmn4hqsoA.png?width=1200)
Variablesを設定
「Twitter Ads API」→「Variables」の順番でクリックします。
以下の5つのVariablesを追加します。
consumer_secret
Twitter連携アプリのAPIキー
consumer_key
Twitter連携アプリのAPIシークレットキー
access_token
Twitter連携アプリのアクセストークン
token_secret
Twitter連携アプリのシークレットトークン
account_id
Twitter広告アカウントのID
version
Twitter広告APIのバージョン(整数)
![](https://assets.st-note.com/img/1649829896212-B2lsFiN665.jpg?width=1200)
Twitter連携アプリのAPIキーなどの確認方法
APIキーやアクセストークンはTwitterデベロッパーポータルの各プロジェクトから確認できます。
![](https://assets.st-note.com/img/1649830236177-ZvQPhN7JXN.jpg?width=1200)
「GET https://ads-api.twitter.com/{{version}}/accounts」の実行
試しに「GET https://ads-api.twitter.com/{{version}}/accounts」を実行して、設定が正しく行えているかを確認します。
「Campaign Management」→「Accounts」→「accounts」の順番でクリックします。
「Send」をクリックします。
結果を確認します。
以下のような結果が返ってくるかを確認します。
また、HTTPステータスコードが200になっているかも確認します。
![](https://assets.st-note.com/img/1649830591502-fb8h0XVcYU.jpg?width=1200)
※HTTPステータスコードが200だが、dataの中身が空になっている場合は広告アカウントが紐付いていない可能性があります。
「https://ads.twitter.com/account_management/広告アカウントID(書き換える)/account_users」にアクセスして、Twitter広告アカウントに紐づくTwitterアカウントの追加を行います。
参考ドキュメント
いいなと思ったら応援しよう!
![村馬賢介](https://assets.st-note.com/production/uploads/images/31752638/profile_c6428708db9397ed888667453388fc9c.jpg?width=600&crop=1:1,smart)