Back to Collection Items
#include <CkHttpW.h>
#include <CkJsonObjectW.h>
#include <CkHttpResponseW.h>
void ChilkatSample(void)
{
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttpW http;
bool success;
http.put_BasicAuth(true);
http.put_Login(L"{{username}}");
http.put_Password(L"{{password}}");
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "query": "query IntrospectionQuery {\n\t__schema {\n\t\tqueryType {\n\t\t\tname\n\t\t}\n\t\tmutationType {\n\t\t\tname\n\t\t}\n\t\tsubscriptionType {\n\t\t\tname\n\t\t}\n\t\ttypes {\n\t\t\t...FullType\n\t\t}\n\t\tdirectives {\n\t\t\tname\n\t\t\tdescription\n\t\t\tlocations\n\t\t\targs {\n\t\t\t\t...InputValue\n\t\t\t}\n\t\t}\n\t}\n}\nfragment FullType on __Type {\n\tkind\n\tname\n\tdescription\n\tfields(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\targs {\n\t\t\t...InputValue\n\t\t}\n\t\ttype {\n\t\t\t...TypeRef\n\t\t}\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinputFields(includeDeprecated: true) {\n\t\t...InputValue\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinterfaces {\n\t\t...TypeRef\n\t}\n\tenumValues(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tpossibleTypes {\n\t\t...TypeRef\n\t}\n}\nfragment InputValue on __InputValue {\n\tname\n\tdescription\n\ttype {\n\t\t...TypeRef\n\t}\n\tdefaultValue\n}\nfragment TypeRef on __Type {\n\tkind\n\tname\n\tofType {\n\t\tkind\n\t\tname\n\t\tofType {\n\t\t\tkind\n\t\t\tname\n\t\t\tofType {\n\t\t\t\tkind\n\t\t\t\tname\n\t\t\t\tofType {\n\t\t\t\t\tkind\n\t\t\t\t\tname\n\t\t\t\t\tofType {\n\t\t\t\t\t\tkind\n\t\t\t\t\t\tname\n\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
// "variables": ""
// }
CkJsonObjectW json;
json.UpdateString(L"query",L"query IntrospectionQuery {\n __schema {\n queryType {\n name\n }\n mutationType {\n name\n }\n subscriptionType {\n name\n }\n types {\n ...FullType\n }\n directives {\n name\n description\n locations\n args {\n ...InputValue\n }\n }\n }\n}\nfragment FullType on __Type {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields(includeDeprecated: true) {\n ...InputValue\n isDeprecated\n deprecationReason\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n}\nfragment InputValue on __InputValue {\n name\n description\n type {\n ...TypeRef\n }\n defaultValue\n}\nfragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n}");
json.UpdateString(L"variables",L"");
http.SetRequestHeader(L"Content-Type",L"application/json");
http.SetRequestHeader(L"MARKETPLACER-API-KEY",L"{{api_key}}");
CkHttpResponseW *resp = http.PostJson3(L"https://bestfriendbazaar.com/graphql",L"application/json",json);
if (http.get_LastMethodSuccess() == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
wprintf(L"%d\n",resp->get_StatusCode());
wprintf(L"%s\n",resp->bodyStr());
delete resp;
}
Curl Command
curl -X POST
-u '{{username}}:{{password}}'
-H "MARKETPLACER-API-KEY: {{api_key}}"
-H "Content-Type: application/json"
--data-raw '{"query":"query IntrospectionQuery {\n\t__schema {\n\t\tqueryType {\n\t\t\tname\n\t\t}\n\t\tmutationType {\n\t\t\tname\n\t\t}\n\t\tsubscriptionType {\n\t\t\tname\n\t\t}\n\t\ttypes {\n\t\t\t...FullType\n\t\t}\n\t\tdirectives {\n\t\t\tname\n\t\t\tdescription\n\t\t\tlocations\n\t\t\targs {\n\t\t\t\t...InputValue\n\t\t\t}\n\t\t}\n\t}\n}\nfragment FullType on __Type {\n\tkind\n\tname\n\tdescription\n\tfields(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\targs {\n\t\t\t...InputValue\n\t\t}\n\t\ttype {\n\t\t\t...TypeRef\n\t\t}\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinputFields(includeDeprecated: true) {\n\t\t...InputValue\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinterfaces {\n\t\t...TypeRef\n\t}\n\tenumValues(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tpossibleTypes {\n\t\t...TypeRef\n\t}\n}\nfragment InputValue on __InputValue {\n\tname\n\tdescription\n\ttype {\n\t\t...TypeRef\n\t}\n\tdefaultValue\n}\nfragment TypeRef on __Type {\n\tkind\n\tname\n\tofType {\n\t\tkind\n\t\tname\n\t\tofType {\n\t\t\tkind\n\t\t\tname\n\t\t\tofType {\n\t\t\t\tkind\n\t\t\t\tname\n\t\t\t\tofType {\n\t\t\t\t\tkind\n\t\t\t\t\tname\n\t\t\t\t\tofType {\n\t\t\t\t\t\tkind\n\t\t\t\t\t\tname\n\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}","variables":""}'
https://bestfriendbazaar.com/graphql
Postman Collection Item JSON
{
"name": "Introspection",
"request": {
"method": "POST",
"header": [
{
"key": "MARKETPLACER-API-KEY",
"value": "{{api_key}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "graphql",
"graphql": {
"query": "query IntrospectionQuery {\n\t__schema {\n\t\tqueryType {\n\t\t\tname\n\t\t}\n\t\tmutationType {\n\t\t\tname\n\t\t}\n\t\tsubscriptionType {\n\t\t\tname\n\t\t}\n\t\ttypes {\n\t\t\t...FullType\n\t\t}\n\t\tdirectives {\n\t\t\tname\n\t\t\tdescription\n\t\t\tlocations\n\t\t\targs {\n\t\t\t\t...InputValue\n\t\t\t}\n\t\t}\n\t}\n}\nfragment FullType on __Type {\n\tkind\n\tname\n\tdescription\n\tfields(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\targs {\n\t\t\t...InputValue\n\t\t}\n\t\ttype {\n\t\t\t...TypeRef\n\t\t}\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinputFields(includeDeprecated: true) {\n\t\t...InputValue\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinterfaces {\n\t\t...TypeRef\n\t}\n\tenumValues(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tpossibleTypes {\n\t\t...TypeRef\n\t}\n}\nfragment InputValue on __InputValue {\n\tname\n\tdescription\n\ttype {\n\t\t...TypeRef\n\t}\n\tdefaultValue\n}\nfragment TypeRef on __Type {\n\tkind\n\tname\n\tofType {\n\t\tkind\n\t\tname\n\t\tofType {\n\t\t\tkind\n\t\t\tname\n\t\t\tofType {\n\t\t\t\tkind\n\t\t\t\tname\n\t\t\t\tofType {\n\t\t\t\t\tkind\n\t\t\t\t\tname\n\t\t\t\t\tofType {\n\t\t\t\t\t\tkind\n\t\t\t\t\t\tname\n\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
"variables": ""
}
},
"url": {
"raw": "{{base_url}}",
"host": [
"{{base_url}}"
],
"path": null
},
"description": null
},
"response": [
]
}