Back to Collection Items
var
http: TChilkatHttp;
success: Integer;
json: TChilkatJsonObject;
resp: IChilkatHttpResponse;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := TChilkatHttp.Create(Self);
http.BasicAuth := 1;
http.Login := '{{username}}';
http.Password := '{{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": ""
// }
json := TChilkatJsonObject.Create(Self);
json.UpdateString('query','query IntrospectionQuery {' + #10 + ' __schema {' + #10 + ' queryType {' + #10 + ' name' + #10 + ' }' + #10 + ' mutationType {' + #10 + ' name' + #10 + ' }' + #10 + ' subscriptionType {' + #10 + ' name' + #10 + ' }' + #10 + ' types {' + #10 + ' ...FullType' + #10 + ' }' + #10 + ' directives {' + #10 + ' name' + #10 + ' description' + #10 + ' locations' + #10 + ' args {' + #10 + ' ...InputValue' + #10 + ' }' + #10 + ' }' + #10 + ' }' + #10 + '}' + #10 + 'fragment FullType on __Type {' + #10 + ' kind' + #10 + ' name' + #10 + ' description' + #10 + ' fields(includeDeprecated: true) {' + #10 + ' name' + #10 + ' description' + #10 + ' args {' + #10 + ' ...InputValue' + #10 + ' }' + #10 + ' type {' + #10 + ' ...TypeRef' + #10 + ' }' + #10 + ' isDeprecated' + #10 + ' deprecationReason' + #10 + ' }' + #10 + ' inputFields(includeDeprecated: true) {' + #10 + ' ...InputValue' + #10 + ' isDeprecated' + #10 + ' deprecationReason' + #10 + ' }' + #10 + ' interfaces {' + #10 + ' ...TypeRef' + #10 + ' }' + #10 + ' enumValues(includeDeprecated: true) {' + #10 + ' name' + #10 + ' description' + #10 + ' isDeprecated' + #10 + ' deprecationReason' + #10 + ' }' + #10 + ' possibleTypes {' + #10 + ' ...TypeRef' + #10 + ' }' + #10 + '}' + #10 + 'fragment InputValue on __InputValue {' + #10 + ' name' + #10 + ' description' + #10 + ' type {' + #10 + ' ...TypeRef' + #10 + ' }' + #10 + ' defaultValue' + #10 + '}' + #10 + 'fragment TypeRef on __Type {' + #10 + ' kind' + #10 + ' name' + #10 + ' ofType {' + #10 + ' kind' + #10 + ' name' + #10 + ' ofType {' + #10 + ' kind' + #10 + ' name' + #10 + ' ofType {' + #10 + ' kind' + #10 + ' name' + #10 + ' ofType {' + #10 + ' kind' + #10 + ' name' + #10 + ' ofType {' + #10 + ' kind' + #10 + ' name' + #10 + ' ofType {' + #10 + ' kind' + #10 + ' name' + #10 + ' ofType {' + #10 + ' kind' + #10 + ' name' + #10 + ' }' + #10 + ' }' + #10 + ' }' + #10 + ' }' + #10 + ' }' + #10 + ' }' + #10 + ' }' + #10 + '}');
json.UpdateString('variables','');
http.SetRequestHeader('Content-Type','application/json');
http.SetRequestHeader('MARKETPLACER-API-KEY','{{api_key}}');
resp := http.PostJson3('https://bestfriendbazaar.com/graphql','application/json',json.ControlInterface);
if (http.LastMethodSuccess = 0) then
begin
Memo1.Lines.Add(http.LastErrorText);
Exit;
end;
Memo1.Lines.Add(IntToStr(resp.StatusCode));
Memo1.Lines.Add(resp.BodyStr);
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": [
]
}