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 PromotionQuery($status: String, $pageSize: Int, $endCursor: String) {\n\tpromotions(status: $status, first: $pageSize, after: $endCursor) {\n\t\ttotalCount\n\t\tpageInfo {\n\t\t\thasNextPage\n\t\t\tendCursor\n\t\t}\n\t\tnodes {\n\t\t\tid\n\t\t\tseller {\n\t\t\t\tid\n\t\t\t\tbusinessName\n\t\t\t}\n\t\t\tname\n\t\t\tteaser\n\t\t\tdescription\n\t\t\tstartDate\n\t\t\tendDate\n\t\t\tminimumSpend\n\t\t\tmaximumSpend\n\t\t\tsuspended\n\t\t\tdiscountType\n\t\t\tdiscountAmount\n\t\t\tfreeShipping\n\t\t\tcostPercentageBorneByMarketplace\n\t\t\tloyaltyProgramLevels (first: $pageSize, after: $endCursor){\n\t\t\t\tnodes {\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tfreeShippingDomesticOnly\n\t\t\tbrandsIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tname\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tbrandsExcluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tname\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tcategoriesIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tcategoriesExcluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tadvertsIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdescription\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tadvertsExcluded (first: $pageSize, after: $endCursor) {\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdescription\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tvariantsIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tsku\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tvariantsExcluded (first: $pageSize, after: $endCursor) {\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tsku\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tsaleItemsExcluded\n\t\t}\n\t}\n}\n\nfragment PageInfoPartial on PageInfo {\n\thasNextPage\n\tendCursor\n}\n",
; "variables": "{\n\t\"status\": \"active\",\n\t\"pageSize\": 10,\n\t\"endCursor\": \"\"\n}"
; }
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.UpdateString("query","query PromotionQuery($status: String, $pageSize: Int, $endCursor: String) {" & @LF & " promotions(status: $status, first: $pageSize, after: $endCursor) {" & @LF & " totalCount" & @LF & " pageInfo {" & @LF & " hasNextPage" & @LF & " endCursor" & @LF & " }" & @LF & " nodes {" & @LF & " id" & @LF & " seller {" & @LF & " id" & @LF & " businessName" & @LF & " }" & @LF & " name" & @LF & " teaser" & @LF & " description" & @LF & " startDate" & @LF & " endDate" & @LF & " minimumSpend" & @LF & " maximumSpend" & @LF & " suspended" & @LF & " discountType" & @LF & " discountAmount" & @LF & " freeShipping" & @LF & " costPercentageBorneByMarketplace" & @LF & " loyaltyProgramLevels (first: $pageSize, after: $endCursor){" & @LF & " nodes {" & @LF & " name" & @LF & " }" & @LF & " pageInfo{" & @LF & " ...PageInfoPartial" & @LF & " }" & @LF & " }" & @LF & " freeShippingDomesticOnly" & @LF & " brandsIncluded (first: $pageSize, after: $endCursor){" & @LF & " edges {" & @LF & " node {" & @LF & " name" & @LF & " }" & @LF & " }" & @LF & " pageInfo{" & @LF & " ...PageInfoPartial" & @LF & " }" & @LF & " }" & @LF & " brandsExcluded (first: $pageSize, after: $endCursor){" & @LF & " edges {" & @LF & " node {" & @LF & " name" & @LF & " }" & @LF & " }" & @LF & " pageInfo{" & @LF & " ...PageInfoPartial" & @LF & " }" & @LF & " }" & @LF & " categoriesIncluded (first: $pageSize, after: $endCursor){" & @LF & " edges {" & @LF & " node {" & @LF & " displayName" & @LF & " }" & @LF & " }" & @LF & " pageInfo{" & @LF & " ...PageInfoPartial" & @LF & " }" & @LF & " }" & @LF & " categoriesExcluded (first: $pageSize, after: $endCursor){" & @LF & " edges {" & @LF & " node {" & @LF & " displayName" & @LF & " }" & @LF & " }" & @LF & " }" & @LF & " advertsIncluded (first: $pageSize, after: $endCursor){" & @LF & " edges {" & @LF & " node {" & @LF & " description" & @LF & " }" & @LF & " }" & @LF & " pageInfo{" & @LF & " ...PageInfoPartial" & @LF & " }" & @LF & " }" & @LF & " advertsExcluded (first: $pageSize, after: $endCursor) {" & @LF & " edges {" & @LF & " node {" & @LF & " description" & @LF & " }" & @LF & " }" & @LF & " pageInfo{" & @LF & " ...PageInfoPartial" & @LF & " }" & @LF & " }" & @LF & " variantsIncluded (first: $pageSize, after: $endCursor){" & @LF & " edges {" & @LF & " node {" & @LF & " sku" & @LF & " }" & @LF & " }" & @LF & " pageInfo{" & @LF & " ...PageInfoPartial" & @LF & " }" & @LF & " }" & @LF & " variantsExcluded (first: $pageSize, after: $endCursor) {" & @LF & " edges {" & @LF & " node {" & @LF & " sku" & @LF & " }" & @LF & " }" & @LF & " pageInfo{" & @LF & " ...PageInfoPartial" & @LF & " }" & @LF & " }" & @LF & " saleItemsExcluded" & @LF & " }" & @LF & " }" & @LF & "}" & @LF & @LF & "fragment PageInfoPartial on PageInfo {" & @LF & " hasNextPage" & @LF & " endCursor" & @LF & "}" & @LF)
$oJson.UpdateString("variables","{" & @LF & " ""status"": ""active""," & @LF & " ""pageSize"": 10," & @LF & " ""endCursor"": ""\@LF & "}")
$oHttp.SetRequestHeader "Content-Type","application/json"
$oHttp.SetRequestHeader "MARKETPLACER-API-KEY","{{api_key}}"
Local $oResp = $oHttp.PostJson3("https://bestfriendbazaar.com/graphql","application/json",$oJson)
If ($oHttp.LastMethodSuccess = 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 PromotionQuery($status: String, $pageSize: Int, $endCursor: String) {\n\tpromotions(status: $status, first: $pageSize, after: $endCursor) {\n\t\ttotalCount\n\t\tpageInfo {\n\t\t\thasNextPage\n\t\t\tendCursor\n\t\t}\n\t\tnodes {\n\t\t\tid\n\t\t\tseller {\n\t\t\t\tid\n\t\t\t\tbusinessName\n\t\t\t}\n\t\t\tname\n\t\t\tteaser\n\t\t\tdescription\n\t\t\tstartDate\n\t\t\tendDate\n\t\t\tminimumSpend\n\t\t\tmaximumSpend\n\t\t\tsuspended\n\t\t\tdiscountType\n\t\t\tdiscountAmount\n\t\t\tfreeShipping\n\t\t\tcostPercentageBorneByMarketplace\n\t\t\tloyaltyProgramLevels (first: $pageSize, after: $endCursor){\n\t\t\t\tnodes {\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tfreeShippingDomesticOnly\n\t\t\tbrandsIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tname\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tbrandsExcluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tname\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tcategoriesIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tcategoriesExcluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tadvertsIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdescription\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tadvertsExcluded (first: $pageSize, after: $endCursor) {\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdescription\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tvariantsIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tsku\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tvariantsExcluded (first: $pageSize, after: $endCursor) {\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tsku\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tsaleItemsExcluded\n\t\t}\n\t}\n}\n\nfragment PageInfoPartial on PageInfo {\n\thasNextPage\n\tendCursor\n}\n","variables":"{\n\t\"status\": \"active\",\n\t\"pageSize\": 10,\n\t\"endCursor\": \"\"\n}"}'
https://bestfriendbazaar.com/graphql
Postman Collection Item JSON
{
"name": "Promotions 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 PromotionQuery($status: String, $pageSize: Int, $endCursor: String) {\n\tpromotions(status: $status, first: $pageSize, after: $endCursor) {\n\t\ttotalCount\n\t\tpageInfo {\n\t\t\thasNextPage\n\t\t\tendCursor\n\t\t}\n\t\tnodes {\n\t\t\tid\n\t\t\tseller {\n\t\t\t\tid\n\t\t\t\tbusinessName\n\t\t\t}\n\t\t\tname\n\t\t\tteaser\n\t\t\tdescription\n\t\t\tstartDate\n\t\t\tendDate\n\t\t\tminimumSpend\n\t\t\tmaximumSpend\n\t\t\tsuspended\n\t\t\tdiscountType\n\t\t\tdiscountAmount\n\t\t\tfreeShipping\n\t\t\tcostPercentageBorneByMarketplace\n\t\t\tloyaltyProgramLevels (first: $pageSize, after: $endCursor){\n\t\t\t\tnodes {\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tfreeShippingDomesticOnly\n\t\t\tbrandsIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tname\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tbrandsExcluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tname\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tcategoriesIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tcategoriesExcluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdisplayName\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tadvertsIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdescription\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tadvertsExcluded (first: $pageSize, after: $endCursor) {\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tdescription\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tvariantsIncluded (first: $pageSize, after: $endCursor){\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tsku\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tvariantsExcluded (first: $pageSize, after: $endCursor) {\n\t\t\t\tedges {\n\t\t\t\t\tnode {\n\t\t\t\t\t\tsku\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpageInfo{\n\t\t\t\t\t...PageInfoPartial\n\t\t\t\t}\n\t\t\t}\n\t\t\tsaleItemsExcluded\n\t\t}\n\t}\n}\n\nfragment PageInfoPartial on PageInfo {\n\thasNextPage\n\tendCursor\n}\n",
"variables": "{\n\t\"status\": \"active\",\n\t\"pageSize\": 10,\n\t\"endCursor\": \"\"\n}"
}
},
"url": {
"raw": "{{base_url}}",
"host": [
"{{base_url}}"
],
"path": null
},
"description": null
},
"response": [
]
}