How do I get tweet's URL

api

#1

Hi,

I’d like to know how to obtain the url of the tweet from Ads API. I couldn’t find it in the documentation.


#2

@camillagm: You can use the GET accounts/:account_id/scoped_timeline endpoint for this.

$ twurl -H ads-api.twitter.com "/1/accounts/$account_id/scoped_timeline?scoped_to=none&count=1"
{
  "data_type": "status",
  "data": [
    {
      "created_at": "Fri Jan 06 21:39:49 +0000 2017",
      "id": 817485848996253698,
      "id_str": "817485848996253698",
      "text": "example Tweet",
      "truncated": false,
      "entities": {
        "hashtags": [],
        "symbols": [],
        "user_mentions": [],
        "urls": []
      },
      "source": "<a href=\"https://ads-api.twitter.com\" rel=\"nofollow\">Ads API Internal Test App</a>",
      "in_reply_to_status_id": null,
      "in_reply_to_status_id_str": null,
      "in_reply_to_user_id": null,
      "in_reply_to_user_id_str": null,
      "in_reply_to_screen_name": null,
      "user": {
        "id": 756201191646691300,
        "id_str": "756201191646691328",
        "name": "API McTestface",
        "screen_name": "apimctestface",
        "location": "San Francisco, CA",
        "url": null,
        "description": "Into testing and APIs",
        "protected": false,
        "followers_count": 0,
        "friends_count": 0,
        "listed_count": 0,
        "created_at": "Thu Jul 21 18:56:28 +0000 2016",
        "favourites_count": 0,
        "utc_offset": null,
        "time_zone": null,
        "geo_enabled": false,
        "verified": false,
        "statuses_count": 0,
        "lang": "en",
        "contributors_enabled": false,
        "is_translator": false,
        "is_translation_enabled": false,
        "profile_background_color": "000000",
        "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
        "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
        "profile_background_tile": false,
        "profile_image_url": "http://pbs.twimg.com/profile_images/756348317458509825/DTKcRCpS_normal.jpg",
        "profile_image_url_https": "https://pbs.twimg.com/profile_images/756348317458509825/DTKcRCpS_normal.jpg",
        "profile_banner_url": "https://pbs.twimg.com/profile_banners/756201191646691328/1469162431",
        "profile_link_color": "000000",
        "profile_sidebar_border_color": "000000",
        "profile_sidebar_fill_color": "000000",
        "profile_text_color": "000000",
        "profile_use_background_image": false,
        "has_extended_profile": true,
        "default_profile": false,
        "default_profile_image": false,
        "following": null,
        "follow_request_sent": null,
        "notifications": null,
        "translator_type": "none"
      },
      "geo": null,
      "coordinates": null,
      "place": null,
      "contributors": [
        2417045708
      ],
      "retweet_count": 0,
      "favorite_count": 0,
      "favorited": false,
      "retweeted": false,
      "scopes": {
        "followers": false
      },
      "lang": "en"
    }
  ],
  "next_cursor": "AAAAAFhLRpQLNF-sGBSgAA",
  "request": {
    "params": {
      "count": 1,
      "scoped_to": "none",
      "account_id": "18ce54d4x5t"
    }
  }
}

Note: scoped_to=none retrieves Promoted-Only Tweets. Use the followers value to retrieve organic Tweet data.

A Tweet URL is structured as follows: https://twitter.com/{screen_name}/status/{Tweet ID}. You can construct this with the data included in the response. The id attribute is the Tweet ID.

Hope this helps.


Which api will give me Twitter handle name of corresponding account?