Getting tweet_id from promoted tweets



I am trying to get the text for promoted tweets. From what i understand, For this i need to find the tweet_id of the promoted tweet and then make the REST API call.

However, my call for promoted tweets by Id does not work correctly and instead throws the list of all promoted tweets for the account.

resource = '/4/accounts/{account_id}/promoted_tweets'.format(
    params = {'account_id':'1887vp',
            'promoted_tweet_id': '23xk6v'}, #this is where promoted tweet ids will go
    response = Request(client, 'get', resource, params=params).perform()
    print (response.body['data'])

so instead of getting the reply only for this promoted tweet id, i get it for the whole account. What is the miss here?
@juanshishido @Outflink @imit8me


You can either do one of two things:

  1. Make promoted_tweet_id a URL parameter, which corresponds to GET accounts/:account_id/promoted_tweets/:promoted_tweet_id
  2. Change the parameter to promoted_tweet_ids, which corresponds to GET accounts/:account_id/promoted_tweets

If you’re using the Python SDK, you can do the following:

>>> ptw = PromotedTweet.load(account=account, id="270k4z")
>>> type(ptw)
>>> ptw.tweet_id

If you’re using requests directly, you can do:

>>> url = "{account_id}/promoted_tweets/{promoted_tweet_id}".format(account_id=ACCOUNT_ID, promoted_tweet_id="270k4z")
>>> r = requests.get(url, auth=auth)
>>> r.json()["data"]["tweet_id"]

Please also see the example here.