Chilkat Online Tools

Xojo / 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.

Dim http As New Chilkat.Http
Dim success As Boolean

http.BasicAuth = True
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      __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": ""
// }

Dim json As New Chilkat.JsonObject
success = json.UpdateString("query","query IntrospectionQuery {" + EndOfLine.Unix + "      __schema {" + EndOfLine.Unix + "        " + EndOfLine.Unix + "        queryType { name }" + EndOfLine.Unix + "        mutationType { name }" + EndOfLine.Unix + "        subscriptionType { name }" + EndOfLine.Unix + "        types {" + EndOfLine.Unix + "          ...FullType" + EndOfLine.Unix + "        }" + EndOfLine.Unix + "        directives {" + EndOfLine.Unix + "          name" + EndOfLine.Unix + "          description" + EndOfLine.Unix + "          " + EndOfLine.Unix + "          locations" + EndOfLine.Unix + "          args {" + EndOfLine.Unix + "            ...InputValue" + EndOfLine.Unix + "          }" + EndOfLine.Unix + "        }" + EndOfLine.Unix + "      }" + EndOfLine.Unix + "    }" + EndOfLine.Unix + EndOfLine.Unix + "    fragment FullType on __Type {" + EndOfLine.Unix + "      kind" + EndOfLine.Unix + "      name" + EndOfLine.Unix + "      description" + EndOfLine.Unix + "      fields(includeDeprecated: true) {" + EndOfLine.Unix + "        name" + EndOfLine.Unix + "        description" + EndOfLine.Unix + "        args {" + EndOfLine.Unix + "          ...InputValue" + EndOfLine.Unix + "        }" + EndOfLine.Unix + "        type {" + EndOfLine.Unix + "          ...TypeRef" + EndOfLine.Unix + "        }" + EndOfLine.Unix + "        isDeprecated" + EndOfLine.Unix + "        deprecationReason" + EndOfLine.Unix + "      }" + EndOfLine.Unix + "      inputFields {" + EndOfLine.Unix + "        ...InputValue" + EndOfLine.Unix + "      }" + EndOfLine.Unix + "      interfaces {" + EndOfLine.Unix + "        ...TypeRef" + EndOfLine.Unix + "      }" + EndOfLine.Unix + "      enumValues(includeDeprecated: true) {" + EndOfLine.Unix + "        name" + EndOfLine.Unix + "        description" + EndOfLine.Unix + "        isDeprecated" + EndOfLine.Unix + "        deprecationReason" + EndOfLine.Unix + "      }" + EndOfLine.Unix + "      possibleTypes {" + EndOfLine.Unix + "        ...TypeRef" + EndOfLine.Unix + "      }" + EndOfLine.Unix + "    }" + EndOfLine.Unix + EndOfLine.Unix + "    fragment InputValue on __InputValue {" + EndOfLine.Unix + "      name" + EndOfLine.Unix + "      description" + EndOfLine.Unix + "      type { ...TypeRef }" + EndOfLine.Unix + "      defaultValue" + EndOfLine.Unix + "    }" + EndOfLine.Unix + EndOfLine.Unix + "    fragment TypeRef on __Type {" + EndOfLine.Unix + "      kind" + EndOfLine.Unix + "      name" + EndOfLine.Unix + "      ofType {" + EndOfLine.Unix + "        kind" + EndOfLine.Unix + "        name" + EndOfLine.Unix + "        ofType {" + EndOfLine.Unix + "          kind" + EndOfLine.Unix + "          name" + EndOfLine.Unix + "          ofType {" + EndOfLine.Unix + "            kind" + EndOfLine.Unix + "            name" + EndOfLine.Unix + "            ofType {" + EndOfLine.Unix + "              kind" + EndOfLine.Unix + "              name" + EndOfLine.Unix + "              ofType {" + EndOfLine.Unix + "                kind" + EndOfLine.Unix + "                name" + EndOfLine.Unix + "                ofType {" + EndOfLine.Unix + "                  kind" + EndOfLine.Unix + "                  name" + EndOfLine.Unix + "                  ofType {" + EndOfLine.Unix + "                    kind" + EndOfLine.Unix + "                    name" + EndOfLine.Unix + "                  }" + EndOfLine.Unix + "                }" + EndOfLine.Unix + "              }" + EndOfLine.Unix + "            }" + EndOfLine.Unix + "          }" + EndOfLine.Unix + "        }" + EndOfLine.Unix + "      }" + EndOfLine.Unix + "    }")
success = json.UpdateString("variables","")

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

Dim resp As Chilkat.HttpResponse
resp = http.PostJson3("https://bestfriendbazaar.com/graphql","application/json",json)
If (http.LastMethodSuccess = False) Then
    System.DebugLog(http.LastErrorText)
    Return
End If

System.DebugLog(Str(resp.StatusCode))
System.DebugLog(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      __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": [
  ]
}