Chilkat Online Tools

Xojo / Marketplacer SELLER API / Get Custom Field Groups

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 GetCustomFieldGroups (\n\t$pageSizeGroups: Int, \n\t$afterCursorGroups: String\n\t$pageSizeFields: Int,\n\t$afterCursorFields: String\n){\n\tcustomFieldGroups (first: $pageSizeGroups after: $afterCursorGroups){\n\t\tnodes {\n\t\t\tid\n\t\t\tname\n\t\t\tdescription\n\t\t\tentity\n\t\t\tcustomFields (first: $pageSizeFields after: $afterCursorFields ) {\n\t\t\t\tnodes {\n\t\t\t\t\tid\n\t\t\t\t\tname\n\t\t\t\t\tdescription\n\t\t\t\t\tplaceholder\n\t\t\t\t\tfieldType\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpageInfo{\n\t\t\t...PageInfoPartial\n\t\t}\n\t}\n}\n\nfragment PageInfoPartial on PageInfo {\n\thasNextPage\n\tendCursor\n}",
//   "variables": "{\n\t\"pageSizeGroups\": 50,\n\t\"afterCursorGroups\": \"\",\n\t\"pageSizeFields\": 10,\n\t\"afterCursorFields\": \"\"\n}"
// }

Dim json As New Chilkat.JsonObject
success = json.UpdateString("query","query GetCustomFieldGroups (" + EndOfLine.Unix + "	$pageSizeGroups: Int, " + EndOfLine.Unix + "	$afterCursorGroups: String" + EndOfLine.Unix + "	$pageSizeFields: Int," + EndOfLine.Unix + "	$afterCursorFields: String" + EndOfLine.Unix + "){" + EndOfLine.Unix + "	customFieldGroups (first: $pageSizeGroups after: $afterCursorGroups){" + EndOfLine.Unix + "		nodes {" + EndOfLine.Unix + "			id" + EndOfLine.Unix + "			name" + EndOfLine.Unix + "			description" + EndOfLine.Unix + "			entity" + EndOfLine.Unix + "			customFields (first: $pageSizeFields after: $afterCursorFields ) {" + EndOfLine.Unix + "				nodes {" + EndOfLine.Unix + "					id" + EndOfLine.Unix + "					name" + EndOfLine.Unix + "					description" + EndOfLine.Unix + "					placeholder" + EndOfLine.Unix + "					fieldType" + EndOfLine.Unix + "				}" + EndOfLine.Unix + "			}" + EndOfLine.Unix + "		}" + EndOfLine.Unix + "		pageInfo{" + EndOfLine.Unix + "			...PageInfoPartial" + EndOfLine.Unix + "		}" + EndOfLine.Unix + "	}" + EndOfLine.Unix + "}" + EndOfLine.Unix + EndOfLine.Unix + "fragment PageInfoPartial on PageInfo {" + EndOfLine.Unix + "	hasNextPage" + EndOfLine.Unix + "	endCursor" + EndOfLine.Unix + "}")
success = json.UpdateString("variables","{" + EndOfLine.Unix + "	""pageSizeGroups"": 50," + EndOfLine.Unix + "	""afterCursorGroups"": """"," + EndOfLine.Unix + "	""pageSizeFields"": 10," + EndOfLine.Unix + "	""afterCursorFields"": ""\EndOfLine.Unix + "}")

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 GetCustomFieldGroups (\n\t$pageSizeGroups: Int, \n\t$afterCursorGroups: String\n\t$pageSizeFields: Int,\n\t$afterCursorFields: String\n){\n\tcustomFieldGroups (first: $pageSizeGroups after: $afterCursorGroups){\n\t\tnodes {\n\t\t\tid\n\t\t\tname\n\t\t\tdescription\n\t\t\tentity\n\t\t\tcustomFields (first: $pageSizeFields after: $afterCursorFields ) {\n\t\t\t\tnodes {\n\t\t\t\t\tid\n\t\t\t\t\tname\n\t\t\t\t\tdescription\n\t\t\t\t\tplaceholder\n\t\t\t\t\tfieldType\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpageInfo{\n\t\t\t...PageInfoPartial\n\t\t}\n\t}\n}\n\nfragment PageInfoPartial on PageInfo {\n\thasNextPage\n\tendCursor\n}","variables":"{\n\t\"pageSizeGroups\": 50,\n\t\"afterCursorGroups\": \"\",\n\t\"pageSizeFields\": 10,\n\t\"afterCursorFields\": \"\"\n}"}'
https://bestfriendbazaar.com/graphql

Postman Collection Item JSON

{
  "name": "Get Custom Field Groups",
  "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 GetCustomFieldGroups (\n\t$pageSizeGroups: Int, \n\t$afterCursorGroups: String\n\t$pageSizeFields: Int,\n\t$afterCursorFields: String\n){\n\tcustomFieldGroups (first: $pageSizeGroups after: $afterCursorGroups){\n\t\tnodes {\n\t\t\tid\n\t\t\tname\n\t\t\tdescription\n\t\t\tentity\n\t\t\tcustomFields (first: $pageSizeFields after: $afterCursorFields ) {\n\t\t\t\tnodes {\n\t\t\t\t\tid\n\t\t\t\t\tname\n\t\t\t\t\tdescription\n\t\t\t\t\tplaceholder\n\t\t\t\t\tfieldType\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tpageInfo{\n\t\t\t...PageInfoPartial\n\t\t}\n\t}\n}\n\nfragment PageInfoPartial on PageInfo {\n\thasNextPage\n\tendCursor\n}",
        "variables": "{\n\t\"pageSizeGroups\": 50,\n\t\"afterCursorGroups\": \"\",\n\t\"pageSizeFields\": 10,\n\t\"afterCursorFields\": \"\"\n}"
      }
    },
    "url": {
      "raw": "{{base_url}}",
      "host": [
        "{{base_url}}"
      ],
      "path": null
    },
    "description": null
  },
  "response": [
  ]
}