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.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* 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 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 args {\n ...InputValue\n }\n onOperation\n onFragment\n onField\n locations\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 {\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}\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 }\n }\n }\n}\n",
* "variables": ""
* }
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("query","query IntrospectionQuery {" + CHR(10) + " __schema {" + CHR(10) + " queryType {" + CHR(10) + " name" + CHR(10) + " }" + CHR(10) + " mutationType {" + CHR(10) + " name" + CHR(10) + " }" + CHR(10) + " subscriptionType {" + CHR(10) + " name" + CHR(10) + " }" + CHR(10) + " types {" + CHR(10) + " ...FullType" + CHR(10) + " }" + CHR(10) + " directives {" + CHR(10) + " name" + CHR(10) + " description" + CHR(10) + " args {" + CHR(10) + " ...InputValue" + CHR(10) + " }" + CHR(10) + " onOperation" + CHR(10) + " onFragment" + CHR(10) + " onField" + CHR(10) + " locations" + 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) + "fragment InputValue on __InputValue {" + CHR(10) + " name" + CHR(10) + " description" + CHR(10) + " type {" + CHR(10) + " ...TypeRef" + CHR(10) + " }" + CHR(10) + " defaultValue" + 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) + " }" + CHR(10) + " }" + CHR(10) + " }" + CHR(10) + "}" + CHR(10))
loJson.UpdateString("variables","")
* Adds the "Authorization: Bearer <access_token>" header.
loHttp.AuthToken = "<access_token>"
loHttp.SetRequestHeader("X-Chatter-Entity-Encoding","false")
loResp = loHttp.PostJson3("https://domain.com/services/data/v{{version}}/graphql","application/json",loJson)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loJson
CANCEL
ENDIF
? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loResp
RELEASE loHttp
RELEASE loJson
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "X-Chatter-Entity-Encoding: false"
--data-raw '{"query":"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 args {\n ...InputValue\n }\n onOperation\n onFragment\n onField\n locations\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 {\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}\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 }\n }\n }\n}\n","variables":""}'
https://domain.com/services/data/v{{version}}/graphql
Postman Collection Item JSON
{
"name": "Introspection Query",
"request": {
"method": "POST",
"header": [
{
"key": "X-Chatter-Entity-Encoding",
"value": "false",
"type": "text"
}
],
"body": {
"mode": "graphql",
"graphql": {
"query": "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 args {\n ...InputValue\n }\n onOperation\n onFragment\n onField\n locations\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 {\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}\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 }\n }\n }\n}\n",
"variables": ""
}
},
"url": {
"raw": "{{_endpoint}}/services/data/v{{version}}/graphql",
"host": [
"{{_endpoint}}"
],
"path": [
"services",
"data",
"v{{version}}",
"graphql"
]
}
},
"response": [
]
}