Chilkat Online Tools

Python / Marketplacer SELLER API / Introspection

Back to Collection Items

import sys
import chilkat2

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

http = chilkat2.Http()

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\t__schema {\n\t\tqueryType {\n\t\t\tname\n\t\t}\n\t\tmutationType {\n\t\t\tname\n\t\t}\n\t\tsubscriptionType {\n\t\t\tname\n\t\t}\n\t\ttypes {\n\t\t\t...FullType\n\t\t}\n\t\tdirectives {\n\t\t\tname\n\t\t\tdescription\n\t\t\tlocations\n\t\t\targs {\n\t\t\t\t...InputValue\n\t\t\t}\n\t\t}\n\t}\n}\nfragment FullType on __Type {\n\tkind\n\tname\n\tdescription\n\tfields(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\targs {\n\t\t\t...InputValue\n\t\t}\n\t\ttype {\n\t\t\t...TypeRef\n\t\t}\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinputFields(includeDeprecated: true) {\n\t\t...InputValue\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinterfaces {\n\t\t...TypeRef\n\t}\n\tenumValues(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tpossibleTypes {\n\t\t...TypeRef\n\t}\n}\nfragment InputValue on __InputValue {\n\tname\n\tdescription\n\ttype {\n\t\t...TypeRef\n\t}\n\tdefaultValue\n}\nfragment TypeRef on __Type {\n\tkind\n\tname\n\tofType {\n\t\tkind\n\t\tname\n\t\tofType {\n\t\t\tkind\n\t\t\tname\n\t\t\tofType {\n\t\t\t\tkind\n\t\t\t\tname\n\t\t\t\tofType {\n\t\t\t\t\tkind\n\t\t\t\t\tname\n\t\t\t\t\tofType {\n\t\t\t\t\t\tkind\n\t\t\t\t\t\tname\n\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
#   "variables": ""
# }

json = chilkat2.JsonObject()
json.UpdateString("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			locations\n			args {\n				...InputValue\n			}\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(includeDeprecated: true) {\n		...InputValue\n		isDeprecated\n		deprecationReason\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				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}")
json.UpdateString("variables","")

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

# resp is a CkHttpResponse
resp = http.PostJson3("https://bestfriendbazaar.com/graphql","application/json",json)
if (http.LastMethodSuccess == False):
    print(http.LastErrorText)
    sys.exit()

print(str(resp.StatusCode))
print(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\t__schema {\n\t\tqueryType {\n\t\t\tname\n\t\t}\n\t\tmutationType {\n\t\t\tname\n\t\t}\n\t\tsubscriptionType {\n\t\t\tname\n\t\t}\n\t\ttypes {\n\t\t\t...FullType\n\t\t}\n\t\tdirectives {\n\t\t\tname\n\t\t\tdescription\n\t\t\tlocations\n\t\t\targs {\n\t\t\t\t...InputValue\n\t\t\t}\n\t\t}\n\t}\n}\nfragment FullType on __Type {\n\tkind\n\tname\n\tdescription\n\tfields(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\targs {\n\t\t\t...InputValue\n\t\t}\n\t\ttype {\n\t\t\t...TypeRef\n\t\t}\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinputFields(includeDeprecated: true) {\n\t\t...InputValue\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinterfaces {\n\t\t...TypeRef\n\t}\n\tenumValues(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tpossibleTypes {\n\t\t...TypeRef\n\t}\n}\nfragment InputValue on __InputValue {\n\tname\n\tdescription\n\ttype {\n\t\t...TypeRef\n\t}\n\tdefaultValue\n}\nfragment TypeRef on __Type {\n\tkind\n\tname\n\tofType {\n\t\tkind\n\t\tname\n\t\tofType {\n\t\t\tkind\n\t\t\tname\n\t\t\tofType {\n\t\t\t\tkind\n\t\t\t\tname\n\t\t\t\tofType {\n\t\t\t\t\tkind\n\t\t\t\t\tname\n\t\t\t\t\tofType {\n\t\t\t\t\t\tkind\n\t\t\t\t\t\tname\n\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}","variables":""}'
https://bestfriendbazaar.com/graphql

Postman Collection Item JSON

{
  "name": "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\t__schema {\n\t\tqueryType {\n\t\t\tname\n\t\t}\n\t\tmutationType {\n\t\t\tname\n\t\t}\n\t\tsubscriptionType {\n\t\t\tname\n\t\t}\n\t\ttypes {\n\t\t\t...FullType\n\t\t}\n\t\tdirectives {\n\t\t\tname\n\t\t\tdescription\n\t\t\tlocations\n\t\t\targs {\n\t\t\t\t...InputValue\n\t\t\t}\n\t\t}\n\t}\n}\nfragment FullType on __Type {\n\tkind\n\tname\n\tdescription\n\tfields(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\targs {\n\t\t\t...InputValue\n\t\t}\n\t\ttype {\n\t\t\t...TypeRef\n\t\t}\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinputFields(includeDeprecated: true) {\n\t\t...InputValue\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tinterfaces {\n\t\t...TypeRef\n\t}\n\tenumValues(includeDeprecated: true) {\n\t\tname\n\t\tdescription\n\t\tisDeprecated\n\t\tdeprecationReason\n\t}\n\tpossibleTypes {\n\t\t...TypeRef\n\t}\n}\nfragment InputValue on __InputValue {\n\tname\n\tdescription\n\ttype {\n\t\t...TypeRef\n\t}\n\tdefaultValue\n}\nfragment TypeRef on __Type {\n\tkind\n\tname\n\tofType {\n\t\tkind\n\t\tname\n\t\tofType {\n\t\t\tkind\n\t\t\tname\n\t\t\tofType {\n\t\t\t\tkind\n\t\t\t\tname\n\t\t\t\tofType {\n\t\t\t\t\tkind\n\t\t\t\t\tname\n\t\t\t\t\tofType {\n\t\t\t\t\t\tkind\n\t\t\t\t\t\tname\n\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\tofType {\n\t\t\t\t\t\t\t\tkind\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
        "variables": ""
      }
    },
    "url": {
      "raw": "{{base_url}}",
      "host": [
        "{{base_url}}"
      ],
      "path": null
    },
    "description": null
  },
  "response": [
  ]
}