Back to Collection Items
#include <C_CkHttpW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkJsonObjectW.h>
void ChilkatSample(void)
{
HCkHttpW http;
BOOL success;
HCkStringBuilderW sbResponseBody;
HCkJsonObjectW jResp;
int respStatusCode;
const wchar_t *tooling;
const wchar_t *metadata;
const wchar_t *eclair;
const wchar_t *folders;
const wchar_t *prechatForms;
const wchar_t *contact_tracing;
const wchar_t *jsonxform;
const wchar_t *chatter;
const wchar_t *payments;
const wchar_t *tabs;
const wchar_t *appMenu;
const wchar_t *quickActions;
const wchar_t *queryAll;
const wchar_t *commerce;
const wchar_t *wave;
const wchar_t *iot;
const wchar_t *analytics;
const wchar_t *search;
const wchar_t *smartdatadiscovery;
const wchar_t *identity;
const wchar_t *composite;
const wchar_t *parameterizedSearch;
const wchar_t *fingerprint;
const wchar_t *theme;
const wchar_t *nouns;
const wchar_t *domino;
const wchar_t *v_event;
const wchar_t *serviceTemplates;
const wchar_t *recent;
const wchar_t *connect;
const wchar_t *licensing;
const wchar_t *limits;
const wchar_t *process;
const wchar_t *dedupe;
const wchar_t *async_queries;
const wchar_t *query;
const wchar_t *jobs;
const wchar_t *match;
const wchar_t *localizedvalue;
const wchar_t *mobile;
const wchar_t *emailConnect;
const wchar_t *consent;
const wchar_t *tokenizer;
const wchar_t *compactLayouts;
const wchar_t *knowledgeManagement;
const wchar_t *sobjects;
const wchar_t *actions;
const wchar_t *support;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
// Adds the "Authorization: Bearer <access_token>" header.
CkHttpW_putAuthToken(http,L"<access_token>");
CkHttpW_SetRequestHeader(http,L"Content-Type",L"application/json");
sbResponseBody = CkStringBuilderW_Create();
success = CkHttpW_QuickGetSb(http,L"https://domain.com/services/data/v{{version}}/",sbResponseBody);
if (success == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
jResp = CkJsonObjectW_Create();
CkJsonObjectW_LoadSb(jResp,sbResponseBody);
CkJsonObjectW_putEmitCompact(jResp,FALSE);
wprintf(L"Response Body:\n");
wprintf(L"%s\n",CkJsonObjectW_emit(jResp));
respStatusCode = CkHttpW_getLastStatus(http);
wprintf(L"Response Status Code = %d\n",respStatusCode);
if (respStatusCode >= 400) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkHttpW_lastHeader(http));
wprintf(L"Failed.\n");
CkHttpW_Dispose(http);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jResp);
return;
}
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "tooling": "/services/data/v58.0/tooling",
// "metadata": "/services/data/v58.0/metadata",
// "eclair": "/services/data/v58.0/eclair",
// "folders": "/services/data/v58.0/folders",
// "prechatForms": "/services/data/v58.0/prechatForms",
// "contact-tracing": "/services/data/v58.0/contact-tracing",
// "jsonxform": "/services/data/v58.0/jsonxform",
// "chatter": "/services/data/v58.0/chatter",
// "payments": "/services/data/v58.0/payments",
// "tabs": "/services/data/v58.0/tabs",
// "appMenu": "/services/data/v58.0/appMenu",
// "quickActions": "/services/data/v58.0/quickActions",
// "queryAll": "/services/data/v58.0/queryAll",
// "commerce": "/services/data/v58.0/commerce",
// "wave": "/services/data/v58.0/wave",
// "iot": "/services/data/v58.0/iot",
// "analytics": "/services/data/v58.0/analytics",
// "search": "/services/data/v58.0/search",
// "smartdatadiscovery": "/services/data/v58.0/smartdatadiscovery",
// "identity": "https://login.salesforce.com/id/00DB0000000DFgjMAG/005B0000003TOI6IAO",
// "composite": "/services/data/v58.0/composite",
// "parameterizedSearch": "/services/data/v58.0/parameterizedSearch",
// "fingerprint": "/services/data/v58.0/fingerprint",
// "theme": "/services/data/v58.0/theme",
// "nouns": "/services/data/v58.0/nouns",
// "domino": "/services/data/v58.0/domino",
// "event": "/services/data/v58.0/event",
// "serviceTemplates": "/services/data/v58.0/serviceTemplates",
// "recent": "/services/data/v58.0/recent",
// "connect": "/services/data/v58.0/connect",
// "licensing": "/services/data/v58.0/licensing",
// "limits": "/services/data/v58.0/limits",
// "process": "/services/data/v58.0/process",
// "dedupe": "/services/data/v58.0/dedupe",
// "async-queries": "/services/data/v58.0/async-queries",
// "query": "/services/data/v58.0/query",
// "jobs": "/services/data/v58.0/jobs",
// "match": "/services/data/v58.0/match",
// "localizedvalue": "/services/data/v58.0/localizedvalue",
// "mobile": "/services/data/v58.0/mobile",
// "emailConnect": "/services/data/v58.0/emailConnect",
// "consent": "/services/data/v58.0/consent",
// "tokenizer": "/services/data/v58.0/tokenizer",
// "compactLayouts": "/services/data/v58.0/compactLayouts",
// "knowledgeManagement": "/services/data/v58.0/knowledgeManagement",
// "sobjects": "/services/data/v58.0/sobjects",
// "actions": "/services/data/v58.0/actions",
// "support": "/services/data/v58.0/support"
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
// Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
tooling = CkJsonObjectW_stringOf(jResp,L"tooling");
metadata = CkJsonObjectW_stringOf(jResp,L"metadata");
eclair = CkJsonObjectW_stringOf(jResp,L"eclair");
folders = CkJsonObjectW_stringOf(jResp,L"folders");
prechatForms = CkJsonObjectW_stringOf(jResp,L"prechatForms");
contact_tracing = CkJsonObjectW_stringOf(jResp,L"contact-tracing");
jsonxform = CkJsonObjectW_stringOf(jResp,L"jsonxform");
chatter = CkJsonObjectW_stringOf(jResp,L"chatter");
payments = CkJsonObjectW_stringOf(jResp,L"payments");
tabs = CkJsonObjectW_stringOf(jResp,L"tabs");
appMenu = CkJsonObjectW_stringOf(jResp,L"appMenu");
quickActions = CkJsonObjectW_stringOf(jResp,L"quickActions");
queryAll = CkJsonObjectW_stringOf(jResp,L"queryAll");
commerce = CkJsonObjectW_stringOf(jResp,L"commerce");
wave = CkJsonObjectW_stringOf(jResp,L"wave");
iot = CkJsonObjectW_stringOf(jResp,L"iot");
analytics = CkJsonObjectW_stringOf(jResp,L"analytics");
search = CkJsonObjectW_stringOf(jResp,L"search");
smartdatadiscovery = CkJsonObjectW_stringOf(jResp,L"smartdatadiscovery");
identity = CkJsonObjectW_stringOf(jResp,L"identity");
composite = CkJsonObjectW_stringOf(jResp,L"composite");
parameterizedSearch = CkJsonObjectW_stringOf(jResp,L"parameterizedSearch");
fingerprint = CkJsonObjectW_stringOf(jResp,L"fingerprint");
theme = CkJsonObjectW_stringOf(jResp,L"theme");
nouns = CkJsonObjectW_stringOf(jResp,L"nouns");
domino = CkJsonObjectW_stringOf(jResp,L"domino");
v_event = CkJsonObjectW_stringOf(jResp,L"event");
serviceTemplates = CkJsonObjectW_stringOf(jResp,L"serviceTemplates");
recent = CkJsonObjectW_stringOf(jResp,L"recent");
connect = CkJsonObjectW_stringOf(jResp,L"connect");
licensing = CkJsonObjectW_stringOf(jResp,L"licensing");
limits = CkJsonObjectW_stringOf(jResp,L"limits");
process = CkJsonObjectW_stringOf(jResp,L"process");
dedupe = CkJsonObjectW_stringOf(jResp,L"dedupe");
async_queries = CkJsonObjectW_stringOf(jResp,L"async-queries");
query = CkJsonObjectW_stringOf(jResp,L"query");
jobs = CkJsonObjectW_stringOf(jResp,L"jobs");
match = CkJsonObjectW_stringOf(jResp,L"match");
localizedvalue = CkJsonObjectW_stringOf(jResp,L"localizedvalue");
mobile = CkJsonObjectW_stringOf(jResp,L"mobile");
emailConnect = CkJsonObjectW_stringOf(jResp,L"emailConnect");
consent = CkJsonObjectW_stringOf(jResp,L"consent");
tokenizer = CkJsonObjectW_stringOf(jResp,L"tokenizer");
compactLayouts = CkJsonObjectW_stringOf(jResp,L"compactLayouts");
knowledgeManagement = CkJsonObjectW_stringOf(jResp,L"knowledgeManagement");
sobjects = CkJsonObjectW_stringOf(jResp,L"sobjects");
actions = CkJsonObjectW_stringOf(jResp,L"actions");
support = CkJsonObjectW_stringOf(jResp,L"support");
CkHttpW_Dispose(http);
CkStringBuilderW_Dispose(sbResponseBody);
CkJsonObjectW_Dispose(jResp);
}
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
https://domain.com/services/data/v{{version}}/
Postman Collection Item JSON
{
"name": "Resources by Version",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
""
]
},
"description": "Lists available resources for the specified API version, including resource name and URI."
},
"response": [
{
"name": "Resources by Version",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
""
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Tue, 26 Sep 2023 13:29:43 GMT"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000; includeSubDomains"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Robots-Tag",
"value": "none"
},
{
"key": "Cache-Control",
"value": "no-cache,must-revalidate,max-age=0,no-store,private"
},
{
"key": "Sforce-Limit-Info",
"value": "api-usage=3/15000"
},
{
"key": "Content-Type",
"value": "application/json;charset=UTF-8"
},
{
"key": "Vary",
"value": "Accept-Encoding"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
}
],
"cookie": [
],
"body": "{\n \"tooling\": \"/services/data/v58.0/tooling\",\n \"metadata\": \"/services/data/v58.0/metadata\",\n \"eclair\": \"/services/data/v58.0/eclair\",\n \"folders\": \"/services/data/v58.0/folders\",\n \"prechatForms\": \"/services/data/v58.0/prechatForms\",\n \"contact-tracing\": \"/services/data/v58.0/contact-tracing\",\n \"jsonxform\": \"/services/data/v58.0/jsonxform\",\n \"chatter\": \"/services/data/v58.0/chatter\",\n \"payments\": \"/services/data/v58.0/payments\",\n \"tabs\": \"/services/data/v58.0/tabs\",\n \"appMenu\": \"/services/data/v58.0/appMenu\",\n \"quickActions\": \"/services/data/v58.0/quickActions\",\n \"queryAll\": \"/services/data/v58.0/queryAll\",\n \"commerce\": \"/services/data/v58.0/commerce\",\n \"wave\": \"/services/data/v58.0/wave\",\n \"iot\": \"/services/data/v58.0/iot\",\n \"analytics\": \"/services/data/v58.0/analytics\",\n \"search\": \"/services/data/v58.0/search\",\n \"smartdatadiscovery\": \"/services/data/v58.0/smartdatadiscovery\",\n \"identity\": \"https://login.salesforce.com/id/00DB0000000DFgjMAG/005B0000003TOI6IAO\",\n \"composite\": \"/services/data/v58.0/composite\",\n \"parameterizedSearch\": \"/services/data/v58.0/parameterizedSearch\",\n \"fingerprint\": \"/services/data/v58.0/fingerprint\",\n \"theme\": \"/services/data/v58.0/theme\",\n \"nouns\": \"/services/data/v58.0/nouns\",\n \"domino\": \"/services/data/v58.0/domino\",\n \"event\": \"/services/data/v58.0/event\",\n \"serviceTemplates\": \"/services/data/v58.0/serviceTemplates\",\n \"recent\": \"/services/data/v58.0/recent\",\n \"connect\": \"/services/data/v58.0/connect\",\n \"licensing\": \"/services/data/v58.0/licensing\",\n \"limits\": \"/services/data/v58.0/limits\",\n \"process\": \"/services/data/v58.0/process\",\n \"dedupe\": \"/services/data/v58.0/dedupe\",\n \"async-queries\": \"/services/data/v58.0/async-queries\",\n \"query\": \"/services/data/v58.0/query\",\n \"jobs\": \"/services/data/v58.0/jobs\",\n \"match\": \"/services/data/v58.0/match\",\n \"localizedvalue\": \"/services/data/v58.0/localizedvalue\",\n \"mobile\": \"/services/data/v58.0/mobile\",\n \"emailConnect\": \"/services/data/v58.0/emailConnect\",\n \"consent\": \"/services/data/v58.0/consent\",\n \"tokenizer\": \"/services/data/v58.0/tokenizer\",\n \"compactLayouts\": \"/services/data/v58.0/compactLayouts\",\n \"knowledgeManagement\": \"/services/data/v58.0/knowledgeManagement\",\n \"sobjects\": \"/services/data/v58.0/sobjects\",\n \"actions\": \"/services/data/v58.0/actions\",\n \"support\": \"/services/data/v58.0/support\"\n}"
}
]
}