Chilkat Online Tools

DataFlex / Twitter API v2 / Users who bought a ticket to a Space

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    String sTemp1
    Integer iTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Send ComSetRequestHeader To hoHttp "user.fields" ""
    // Adds the "Authorization: Bearer <access_token>" header.
    Set ComAuthToken Of hoHttp To "<access_token>"
    Send ComSetRequestHeader To hoHttp "tweet.fields" ""
    Send ComSetRequestHeader To hoHttp "expansions" ""

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://api.twitter.com/2/spaces/:id/buyers" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComLastStatus Of hoHttp To iTemp1
    Showln "Response status code = " iTemp1
    Get ComGetAsString Of hoSbResponseBody To sTemp1
    Showln sTemp1


End_Procedure

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
	-H "user.fields: "
	-H "expansions: "
	-H "tweet.fields: "
https://api.twitter.com/2/spaces/:id/buyers

Postman Collection Item JSON

{
  "name": "Users who bought a ticket to a Space",
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
      {
        "description": "Comma-separated fields for the user object.\n\nAllowed values:\ncreated_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld\n\nDefault values:\nid,name,username",
        "equals": true,
        "key": "user.fields",
        "type": "text",
        "value": "",
        "disabled": true
      },
      {
        "description": "Expansions enable requests to expand an ID into a full object in the includes response object.\n\nAllowed value:\npinned_tweet_id\n\nDefault value: none",
        "equals": true,
        "key": "expansions",
        "type": "text",
        "value": "",
        "disabled": true
      },
      {
        "description": "Comma-separated list of fields for the Tweet object. Expansion required.\n\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,reply_settings,source,text,withheld\n\nDefault values:\nid,text\n\nOAuth1.0a User Context authorization required if any of the following fields are included in the request:\nnon_public_metrics,organic_metrics,promoted_metrics",
        "equals": true,
        "key": "tweet.fields",
        "type": "text",
        "value": "",
        "disabled": true
      }
    ],
    "url": {
      "raw": "https://api.twitter.com/2/spaces/:id/buyers",
      "protocol": "https",
      "host": [
        "api",
        "twitter",
        "com"
      ],
      "path": [
        "2",
        "spaces",
        ":id",
        "buyers"
      ],
      "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": "pagination_token",
          "value": "",
          "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 user ID whose blocked users you would like to retrieve. The user’s ID must correspond to the user ID of the authenticating user, meaning that you must pass the Access Tokens associated with the user ID when authenticating your request."
        }
      ]
    },
    "description": "Returns a list of users who are blocked by the specified user ID.\n\nFor full details, see the [API reference](https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/get-users-blocking) for this endpoint.\n\n[Sign up](https://t.co/signup) for the Twitter API"
  },
  "response": [
  ]
}