Back to Collection Items
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
; 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": ""
; }
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.UpdateString("query","query IntrospectionQuery {" & @LF & " __schema {" & @LF & " queryType {" & @LF & " name" & @LF & " }" & @LF & " mutationType {" & @LF & " name" & @LF & " }" & @LF & " subscriptionType {" & @LF & " name" & @LF & " }" & @LF & " types {" & @LF & " ...FullType" & @LF & " }" & @LF & " directives {" & @LF & " name" & @LF & " description" & @LF & " args {" & @LF & " ...InputValue" & @LF & " }" & @LF & " onOperation" & @LF & " onFragment" & @LF & " onField" & @LF & " locations" & @LF & " }" & @LF & " }" & @LF & "}" & @LF & "fragment FullType on __Type {" & @LF & " kind" & @LF & " name" & @LF & " description" & @LF & " fields(includeDeprecated: true) {" & @LF & " name" & @LF & " description" & @LF & " args {" & @LF & " ...InputValue" & @LF & " }" & @LF & " type {" & @LF & " ...TypeRef" & @LF & " }" & @LF & " isDeprecated" & @LF & " deprecationReason" & @LF & " }" & @LF & " inputFields {" & @LF & " ...InputValue" & @LF & " }" & @LF & " interfaces {" & @LF & " ...TypeRef" & @LF & " }" & @LF & " enumValues(includeDeprecated: true) {" & @LF & " name" & @LF & " description" & @LF & " isDeprecated" & @LF & " deprecationReason" & @LF & " }" & @LF & " possibleTypes {" & @LF & " ...TypeRef" & @LF & " }" & @LF & "}" & @LF & "fragment InputValue on __InputValue {" & @LF & " name" & @LF & " description" & @LF & " type {" & @LF & " ...TypeRef" & @LF & " }" & @LF & " defaultValue" & @LF & "}" & @LF & "fragment TypeRef on __Type {" & @LF & " kind" & @LF & " name" & @LF & " ofType {" & @LF & " kind" & @LF & " name" & @LF & " ofType {" & @LF & " kind" & @LF & " name" & @LF & " ofType {" & @LF & " kind" & @LF & " name" & @LF & " }" & @LF & " }" & @LF & " }" & @LF & "}" & @LF)
$oJson.UpdateString("variables","")
; Adds the "Authorization: Bearer <access_token>" header.
$oHttp.AuthToken = "<access_token>"
$oHttp.SetRequestHeader "X-Chatter-Entity-Encoding","false"
$oResp = ObjCreate("Chilkat.HttpResponse")
$bSuccess = $oHttp.HttpJson("POST","https://domain.com/services/data/v{{version}}/graphql",$oJson,"application/json",$oResp)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)
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": [
]
}