C / Twitter API v2 / Spaces lookup by single ID
Back to Collection Items
#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>
void ChilkatSample(void)
{
HCkHttp http;
BOOL success;
HCkJsonObject queryParams;
HCkHttpResponse resp;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttp_Create();
queryParams = CkJsonObject_Create();
CkJsonObject_UpdateString(queryParams,"space.fields","");
CkJsonObject_UpdateString(queryParams,"expansions","");
CkJsonObject_UpdateString(queryParams,"user.fields","");
CkJsonObject_UpdateString(queryParams,"topic.fields","");
// Adds the "Authorization: Bearer <access_token>" header.
CkHttp_putAuthToken(http,"<access_token>");
resp = CkHttp_QuickRequestParams(http,"GET","https://api.twitter.com/2/spaces/:id",queryParams);
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
CkJsonObject_Dispose(queryParams);
return;
}
printf("%d\n",CkHttpResponse_getStatusCode(resp));
printf("%s\n",CkHttpResponse_bodyStr(resp));
CkHttpResponse_Dispose(resp);
CkHttp_Dispose(http);
CkJsonObject_Dispose(queryParams);
}
Curl Command
curl -G -d "space.fields="
-d "expansions="
-d "user.fields="
-d "topic.fields="
-H "Authorization: Bearer <access_token>"
https://api.twitter.com/2/spaces/:id
Postman Collection Item JSON
{
"name": "Spaces lookup by single ID",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "",
"type": "string"
}
]
},
"method": "GET",
"header": [
],
"url": {
"raw": "https://api.twitter.com/2/spaces/:id?space.fields=&expansions=&user.fields=&topic.fields",
"protocol": "https",
"host": [
"api",
"twitter",
"com"
],
"path": [
"2",
"spaces",
":id"
],
"query": [
{
"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": "",
"description": "Comma-separated list of fields from the Space object you want to return from your request.\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"
},
{
"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"
}
],
"variable": [
{
"key": "id",
"value": "",
"description": "The ID of the Spaces to lookup."
}
]
},
"description": "This endpoint returns information about a single Space with the specified ID.\n\n[Sign up](https://t.co/signup) for the Twitter API"
},
"response": [
]
}