Chilkat Online Tools

Swift3 / Twitter API v2 / Liking users

Back to Collection Items

func chilkatTest() {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let http = CkoHttp()!
    var success: Bool

    // Adds the "Authorization: Bearer <access_token>" header.
    http.authToken = "<access_token>"

    let sbResponseBody = CkoStringBuilder()!
    success = http.quickGetSb("https://api.twitter.com/2/tweets/:id/liking_users", sbContent: sbResponseBody)
    if success == false {
        print("\(http.lastErrorText!)")
        return
    }

    print("Response status code = \(http.lastStatus.intValue)")
    print("\(sbResponseBody.getAsString()!)")

}

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://api.twitter.com/2/tweets/:id/liking_users

Postman Collection Item JSON

{
  "name": "Liking users",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "https://api.twitter.com/2/tweets/:id/liking_users",
      "protocol": "https",
      "host": [
        "api",
        "twitter",
        "com"
      ],
      "path": [
        "2",
        "tweets",
        ":id",
        "liking_users"
      ],
      "query": [
        {
          "key": "user.fields",
          "value": "",
          "description": "Comma-separated fields for the user object.\nAllowed values:\ncreated_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld\nDefault values:\nid,name,username",
          "disabled": true
        },
        {
          "key": "expansions",
          "value": "",
          "description": "Expansions enable requests to expand an ID into a full object in the includes response object.\nAllowed value:\npinned_tweet_id\nDefault value: none",
          "disabled": true
        },
        {
          "key": "tweet.fields",
          "value": "",
          "description": "Comma-separated list of fields for the Tweet object. Expansion required.\nAllowed values:\nattachments,author_id,context_annotations,conversation_id,created_at,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,source,text,withheld\nDefault values:\nid,text\nOAuth1.0a User Context authorization required if any of the following fields are included in the request:\nnon_public_metrics,organic_metrics,promoted_metrics",
          "disabled": true
        },
        {
          "key": "max_results",
          "value": null,
          "description": "The maximum number of results to be returned by a request.\nAllowed values: 1 through 100.\nDefault value: 100",
          "disabled": true
        },
        {
          "key": "pagination_token",
          "value": null,
          "description": "This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified.",
          "disabled": true
        }
      ],
      "variable": [
        {
          "key": "id",
          "value": "",
          "description": "Required. The Tweet ID of the Tweet to request liking users of."
        }
      ]
    },
    "description": "Returns a list of users who have liked a specified Tweet ID.\n\nFor full details, see the [API reference](https://developer.twitter.com/en/docs/twitter-api/tweets/likes/api-reference/get-tweets-id-liking_users) for this endpoint.\n\n[Sign up](https://t.co/signup) for the Twitter API"
  },
  "response": [
  ]
}