DataFlex / Twitter API v2 / Search Spaces by title
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vQueryParams
Handle hoQueryParams
Variant vResp
Handle hoResp
String sTemp1
Integer iTemp1
Boolean bTemp1
// 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
Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
If (Not(IsComObjectCreated(hoQueryParams))) Begin
Send CreateComObject of hoQueryParams
End
Get ComUpdateString Of hoQueryParams "query" "" To iSuccess
Get ComUpdateString Of hoQueryParams "state" "" To iSuccess
Get ComUpdateString Of hoQueryParams "space.fields" "" To iSuccess
Get ComUpdateString Of hoQueryParams "expansions" "" To iSuccess
Get ComUpdateString Of hoQueryParams "user.fields" "" To iSuccess
Get ComUpdateString Of hoQueryParams "topic.fields" "" To iSuccess
// Adds the "Authorization: Bearer <access_token>" header.
Set ComAuthToken Of hoHttp To "<access_token>"
Get pvComObject of hoQueryParams to vQueryParams
Get ComQuickRequestParams Of hoHttp "GET" "https://api.twitter.com/2/spaces/search" vQueryParams To vResp
If (IsComObject(vResp)) Begin
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
Set pvComObject Of hoResp To vResp
End
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComStatusCode Of hoResp To iTemp1
Showln iTemp1
Get ComBodyStr Of hoResp To sTemp1
Showln sTemp1
Send Destroy of hoResp
End_Procedure
Curl Command
curl -G -d "query="
-d "state="
-d "space.fields="
-d "expansions="
-d "user.fields="
-d "topic.fields="
-H "Authorization: Bearer <access_token>"
https://api.twitter.com/2/spaces/search
Postman Collection Item JSON
{
"name": "Search Spaces by title",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "",
"type": "string"
}
]
},
"method": "GET",
"header": [
],
"url": {
"raw": "https://api.twitter.com/2/spaces/search?query=&state=&space.fields=&expansions=&user.fields&topic.fields",
"protocol": "https",
"host": [
"api",
"twitter",
"com"
],
"path": [
"2",
"spaces",
"search"
],
"query": [
{
"key": "query",
"value": "",
"description": "Required. A search term. Can be a keyword, hashtag, or mention."
},
{
"key": "state",
"value": "",
"description": "Return only Spaces with a specific running status.\n\nAllowed values (specify only one of the following):\nlive,scheduled"
},
{
"key": "space.fields",
"value": "",
"description": "Comma-separated list of fields from the Space object you want to return from your request.\n\nAvailable fields:\nhost_ids,created_at,creator_id,id,lang,invited_user_ids, participant_count,speaker_ids,started_at,state,title,updated_at, scheduled_start,is_ticketed,ended_at,topic_ids\n\nDefault fields:\nid,state"
},
{
"key": "expansions",
"value": "",
"description": "Comma-separated list of fields to expand. Expansions enable requests to expand an ID into a full object in the includes response object.\n\nAvailable values:\ninvited_user_ids,speaker_ids,creator_id,host_ids"
},
{
"key": "user.fields",
"value": null,
"description": "Comma-separated list of fields to expand. Expansions enable requests to expand an ID into a full object in the includes response object.\n\nAvailable 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"
},
{
"key": "topic.fields",
"value": null,
"description": "Comma-separated list of fields from the Space Topics object you want to return from your request\n.\nAvailable values:\nid,name,description"
}
]
},
"description": "This endpoint returns Spaces matching the specified keyword query.\n\n[Sign up](https://t.co/signup) for the Twitter API"
},
"response": [
]
}