Chilkat Online Tools

autoit / Marketplacer SELLER API / Schema Introspection

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

$oHttp.BasicAuth = True
$oHttp.Login = "{{username}}"
$oHttp.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": ""
; }

$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.UpdateString("query","query IntrospectionQuery {" & @LF & "      __schema {" & @LF & "        " & @LF & "        queryType { name }" & @LF & "        mutationType { name }" & @LF & "        subscriptionType { name }" & @LF & "        types {" & @LF & "          ...FullType" & @LF & "        }" & @LF & "        directives {" & @LF & "          name" & @LF & "          description" & @LF & "          " & @LF & "          locations" & @LF & "          args {" & @LF & "            ...InputValue" & @LF & "          }" & @LF & "        }" & @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 & @LF & "    fragment InputValue on __InputValue {" & @LF & "      name" & @LF & "      description" & @LF & "      type { ...TypeRef }" & @LF & "      defaultValue" & @LF & "    }" & @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 & "            ofType {" & @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 & "          }" & @LF & "        }" & @LF & "      }" & @LF & "    }")
$oJson.UpdateString("variables","")

$oHttp.SetRequestHeader "Content-Type","application/json"
$oHttp.SetRequestHeader "MARKETPLACER-API-KEY","{{api_key}}"

$oResp = ObjCreate("Chilkat.HttpResponse")
$bSuccess = $oHttp.HttpJson("POST","https://bestfriendbazaar.com/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
	-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": [
  ]
}