Chilkat Online Tools

lianja / Marketplacer SELLER API / Taxons Query

Back to Collection Items

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

loHttp = createobject("CkHttp")

loHttp.BasicAuth = .T.
loHttp.Login = "{{username}}"
loHttp.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 QueryTaxons(\n\t$pageSize: Int\n\t$l0EndCursor: String\n\t$l1EndCursor: String\n\t$l2EndCursor: String\n) {\n\ttaxons(first: $pageSize, after: $l0EndCursor) {\n\t\ttotalCount\n\t\tpageInfo {\n\t\t\t...PageInfoPartial\n\t\t}\n\t\tedges {\n\t\t\tnode {\n\t\t\t\tid\n\t\t\t\tlegacyId\n\t\t\t\tdisplayName\n\t\t\t\tdescription\n\t\t\t\tgoogleCategory\n\t\t\t\ttaxCode\n\t\t\t\turlSlug\n\t\t\t\ttreeName\n\t\t\t\tprototype {\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t\tchildren(first: $pageSize, after: $l1EndCursor) {\n\t\t\t\t\ttotalCount\n\t\t\t\t\tpageInfo {\n\t\t\t\t\t\t...PageInfoPartial\n\t\t\t\t\t}\n\t\t\t\t\tedges {\n\t\t\t\t\t\tnode {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\tdisplayName\n\t\t\t\t\t\t\ttreeName\n\t\t\t\t\t\t\turlSlug\n\t\t\t\t\t\t\tprototype {\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchildren(first: $pageSize, after: $l2EndCursor) {\n\t\t\t\t\t\t\t\ttotalCount\n\t\t\t\t\t\t\t\tpageInfo {\n\t\t\t\t\t\t\t\t\t...PageInfoPartial\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tedges {\n\t\t\t\t\t\t\t\t\tnode {\n\t\t\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t\t\t\tdisplayName\n\t\t\t\t\t\t\t\t\t\ttreeName\n\t\t\t\t\t\t\t\t\t\turlSlug\n\t\t\t\t\t\t\t\t\t\tprototype {\n\t\t\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\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}\n\nfragment PageInfoPartial on PageInfo {\n\thasNextPage\n\tendCursor\n}\n",
//   "variables": "{\n\t\"pageSize\": 10,\n\t\"l0EndCursor\": null,\n\t\"l1EndCursor\": null,\n\t\"l2EndCursor\": null\n}"
// }

loJson = createobject("CkJsonObject")
loJson.UpdateString("query","query QueryTaxons(" + Chr(10) + "	$pageSize: Int" + Chr(10) + "	$l0EndCursor: String" + Chr(10) + "	$l1EndCursor: String" + Chr(10) + "	$l2EndCursor: String" + Chr(10) + ") {" + Chr(10) + "	taxons(first: $pageSize, after: $l0EndCursor) {" + Chr(10) + "		totalCount" + Chr(10) + "		pageInfo {" + Chr(10) + "			...PageInfoPartial" + Chr(10) + "		}" + Chr(10) + "		edges {" + Chr(10) + "			node {" + Chr(10) + "				id" + Chr(10) + "				legacyId" + Chr(10) + "				displayName" + Chr(10) + "				description" + Chr(10) + "				googleCategory" + Chr(10) + "				taxCode" + Chr(10) + "				urlSlug" + Chr(10) + "				treeName" + Chr(10) + "				prototype {" + Chr(10) + "					name" + Chr(10) + "				}" + Chr(10) + "				children(first: $pageSize, after: $l1EndCursor) {" + Chr(10) + "					totalCount" + Chr(10) + "					pageInfo {" + Chr(10) + "						...PageInfoPartial" + Chr(10) + "					}" + Chr(10) + "					edges {" + Chr(10) + "						node {" + Chr(10) + "							id" + Chr(10) + "							displayName" + Chr(10) + "							treeName" + Chr(10) + "							urlSlug" + Chr(10) + "							prototype {" + Chr(10) + "								name" + Chr(10) + "							}" + Chr(10) + "							children(first: $pageSize, after: $l2EndCursor) {" + Chr(10) + "								totalCount" + Chr(10) + "								pageInfo {" + Chr(10) + "									...PageInfoPartial" + Chr(10) + "								}" + Chr(10) + "								edges {" + Chr(10) + "									node {" + Chr(10) + "										id" + Chr(10) + "										displayName" + Chr(10) + "										treeName" + Chr(10) + "										urlSlug" + Chr(10) + "										prototype {" + Chr(10) + "											name" + Chr(10) + "										}" + Chr(10) + "									}" + Chr(10) + "								}" + Chr(10) + "							}" + Chr(10) + "						}" + Chr(10) + "					}" + Chr(10) + "				}" + Chr(10) + "			}" + Chr(10) + "		}" + Chr(10) + "	}" + Chr(10) + "}" + Chr(10) + Chr(10) + "fragment PageInfoPartial on PageInfo {" + Chr(10) + "	hasNextPage" + Chr(10) + "	endCursor" + Chr(10) + "}" + Chr(10))
loJson.UpdateString("variables",'{' + Chr(10) + '	"pageSize": 10,' + Chr(10) + '	"l0EndCursor": null,' + Chr(10) + '	"l1EndCursor": null,' + Chr(10) + '	"l2EndCursor": null' + Chr(10) + '}')

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

loResp = loHttp.PostJson3("https://bestfriendbazaar.com/graphql","application/json",loJson)
if (loHttp.LastMethodSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loJson
    return
endif

? str(loResp.StatusCode)
? loResp.BodyStr
release loResp


release loHttp
release loJson

Curl Command

curl -X POST
	-u '{{username}}:{{password}}'
	-H "MARKETPLACER-API-KEY: {{api_key}}"
	-H "Content-Type: application/json"
	--data-raw '{"query":"query QueryTaxons(\n\t$pageSize: Int\n\t$l0EndCursor: String\n\t$l1EndCursor: String\n\t$l2EndCursor: String\n) {\n\ttaxons(first: $pageSize, after: $l0EndCursor) {\n\t\ttotalCount\n\t\tpageInfo {\n\t\t\t...PageInfoPartial\n\t\t}\n\t\tedges {\n\t\t\tnode {\n\t\t\t\tid\n\t\t\t\tlegacyId\n\t\t\t\tdisplayName\n\t\t\t\tdescription\n\t\t\t\tgoogleCategory\n\t\t\t\ttaxCode\n\t\t\t\turlSlug\n\t\t\t\ttreeName\n\t\t\t\tprototype {\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t\tchildren(first: $pageSize, after: $l1EndCursor) {\n\t\t\t\t\ttotalCount\n\t\t\t\t\tpageInfo {\n\t\t\t\t\t\t...PageInfoPartial\n\t\t\t\t\t}\n\t\t\t\t\tedges {\n\t\t\t\t\t\tnode {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\tdisplayName\n\t\t\t\t\t\t\ttreeName\n\t\t\t\t\t\t\turlSlug\n\t\t\t\t\t\t\tprototype {\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchildren(first: $pageSize, after: $l2EndCursor) {\n\t\t\t\t\t\t\t\ttotalCount\n\t\t\t\t\t\t\t\tpageInfo {\n\t\t\t\t\t\t\t\t\t...PageInfoPartial\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tedges {\n\t\t\t\t\t\t\t\t\tnode {\n\t\t\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t\t\t\tdisplayName\n\t\t\t\t\t\t\t\t\t\ttreeName\n\t\t\t\t\t\t\t\t\t\turlSlug\n\t\t\t\t\t\t\t\t\t\tprototype {\n\t\t\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\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}\n\nfragment PageInfoPartial on PageInfo {\n\thasNextPage\n\tendCursor\n}\n","variables":"{\n\t\"pageSize\": 10,\n\t\"l0EndCursor\": null,\n\t\"l1EndCursor\": null,\n\t\"l2EndCursor\": null\n}"}'
https://bestfriendbazaar.com/graphql

Postman Collection Item JSON

{
  "name": "Taxons Query",
  "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 QueryTaxons(\n\t$pageSize: Int\n\t$l0EndCursor: String\n\t$l1EndCursor: String\n\t$l2EndCursor: String\n) {\n\ttaxons(first: $pageSize, after: $l0EndCursor) {\n\t\ttotalCount\n\t\tpageInfo {\n\t\t\t...PageInfoPartial\n\t\t}\n\t\tedges {\n\t\t\tnode {\n\t\t\t\tid\n\t\t\t\tlegacyId\n\t\t\t\tdisplayName\n\t\t\t\tdescription\n\t\t\t\tgoogleCategory\n\t\t\t\ttaxCode\n\t\t\t\turlSlug\n\t\t\t\ttreeName\n\t\t\t\tprototype {\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t\tchildren(first: $pageSize, after: $l1EndCursor) {\n\t\t\t\t\ttotalCount\n\t\t\t\t\tpageInfo {\n\t\t\t\t\t\t...PageInfoPartial\n\t\t\t\t\t}\n\t\t\t\t\tedges {\n\t\t\t\t\t\tnode {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\tdisplayName\n\t\t\t\t\t\t\ttreeName\n\t\t\t\t\t\t\turlSlug\n\t\t\t\t\t\t\tprototype {\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchildren(first: $pageSize, after: $l2EndCursor) {\n\t\t\t\t\t\t\t\ttotalCount\n\t\t\t\t\t\t\t\tpageInfo {\n\t\t\t\t\t\t\t\t\t...PageInfoPartial\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tedges {\n\t\t\t\t\t\t\t\t\tnode {\n\t\t\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t\t\t\tdisplayName\n\t\t\t\t\t\t\t\t\t\ttreeName\n\t\t\t\t\t\t\t\t\t\turlSlug\n\t\t\t\t\t\t\t\t\t\tprototype {\n\t\t\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\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}\n\nfragment PageInfoPartial on PageInfo {\n\thasNextPage\n\tendCursor\n}\n",
        "variables": "{\n\t\"pageSize\": 10,\n\t\"l0EndCursor\": null,\n\t\"l1EndCursor\": null,\n\t\"l2EndCursor\": null\n}"
      }
    },
    "url": {
      "raw": "{{base_url}}",
      "host": [
        "{{base_url}}"
      ],
      "path": null
    },
    "description": null
  },
  "response": [
  ]
}