Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loJson
LOCAL loResp
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loHttp = CreateObject('Chilkat.Http')
loHttp.BasicAuth = 1
loHttp.Login = "{{username}}"
loHttp.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 __schema {\n \n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n \n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment 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 {\n ...InputValue\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 }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n }\n\n fragment 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 }",
* "variables": ""
* }
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("query","query IntrospectionQuery {" + CHR(10) + " __schema {" + CHR(10) + " " + CHR(10) + " queryType { name }" + CHR(10) + " mutationType { name }" + CHR(10) + " subscriptionType { name }" + CHR(10) + " types {" + CHR(10) + " ...FullType" + CHR(10) + " }" + CHR(10) + " directives {" + CHR(10) + " name" + CHR(10) + " description" + CHR(10) + " " + CHR(10) + " locations" + CHR(10) + " args {" + CHR(10) + " ...InputValue" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + CHR(10) + " fragment FullType on __Type {" + CHR(10) + " kind" + CHR(10) + " name" + CHR(10) + " description" + CHR(10) + " fields(includeDeprecated: true) {" + CHR(10) + " name" + CHR(10) + " description" + CHR(10) + " args {" + CHR(10) + " ...InputValue" + CHR(10) + " }" + CHR(10) + " type {" + CHR(10) + " ...TypeRef" + CHR(10) + " }" + CHR(10) + " isDeprecated" + CHR(10) + " deprecationReason" + CHR(10) + " }" + CHR(10) + " inputFields {" + CHR(10) + " ...InputValue" + CHR(10) + " }" + CHR(10) + " interfaces {" + CHR(10) + " ...TypeRef" + CHR(10) + " }" + CHR(10) + " enumValues(includeDeprecated: true) {" + CHR(10) + " name" + CHR(10) + " description" + CHR(10) + " isDeprecated" + CHR(10) + " deprecationReason" + CHR(10) + " }" + CHR(10) + " possibleTypes {" + CHR(10) + " ...TypeRef" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + CHR(10) + " fragment InputValue on __InputValue {" + CHR(10) + " name" + CHR(10) + " description" + CHR(10) + " type { ...TypeRef }" + CHR(10) + " defaultValue" + CHR(10) + " }" + CHR(10) + CHR(10) + " fragment TypeRef on __Type {" + CHR(10) + " kind" + CHR(10) + " name" + CHR(10) + " ofType {" + CHR(10) + " kind" + CHR(10) + " name" + CHR(10) + " ofType {" + CHR(10) + " kind" + CHR(10) + " name" + CHR(10) + " ofType {" + CHR(10) + " kind" + CHR(10) + " name" + CHR(10) + " ofType {" + CHR(10) + " kind" + CHR(10) + " name" + CHR(10) + " ofType {" + CHR(10) + " kind" + CHR(10) + " name" + CHR(10) + " ofType {" + CHR(10) + " kind" + CHR(10) + " name" + CHR(10) + " ofType {" + CHR(10) + " kind" + CHR(10) + " name" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + " }")
loJson.UpdateString("variables","")
loHttp.SetRequestHeader("Content-Type","application/json")
loHttp.SetRequestHeader("MARKETPLACER-API-KEY","{{api_key}}")
loResp = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpJson("POST","https://bestfriendbazaar.com/graphql",loJson,"application/json",loResp)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loJson
RELEASE loResp
CANCEL
ENDIF
? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loHttp
RELEASE loJson
RELEASE loResp
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 __schema {\n \n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n \n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment 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 {\n ...InputValue\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 }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n }\n\n fragment 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 }","variables":""}'
https://bestfriendbazaar.com/graphql
Postman Collection Item JSON
{
"name": "Schema 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 __schema {\n \n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n \n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment 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 {\n ...InputValue\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 }\n\n fragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n }\n\n fragment 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 }",
"variables": ""
}
},
"url": {
"raw": "{{base_url}}",
"host": [
"{{base_url}}"
],
"path": null
},
"description": null
},
"response": [
]
}