autoit / Marketplacer SELLER API / Get Invoices with Filtering and Ordering
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 GetInvoicesWithFilteringAndOrdering \n(\n\t$pageSize: Int\n\t$endCursor: String\n\t$sort: InvoiceSort\n\t$filters: InvoiceFilters\n){\n\tinvoices(\n\t\tfirst: $pageSize\n\t\tafter: $endCursor\n\t\tfilters: $filters\n\t\tsort: $sort\n\t) {\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\tcreatedAt\n\t\t\t\tupdatedAt\n\t\t\t\torder {\n\t\t\t\t\tupdatedAt\n\t\t\t\t\tid\n\t\t\t\t}\n\t\t\t\tstatusFlags\n\t\t\t\tlineItems {\n\t\t\t\t\tid\n\t\t\t\t\tvariantId\n\t\t\t\t\tvariantSku\n\t\t\t\t\tvariantBarcode\n\t\t\t\t\tvariantName\n\t\t\t\t\ttotalCents\n\t\t\t\t}\n\t\t\t\tshipments {\n\t\t\t\t\tid\n\t\t\t\t\tdispatchedAt\n\t\t\t\t\tshippedItems {\n\t\t\t\t\t\tid\n\t\t\t\t\t\tlineItem {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\tadvertTitle\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\": 100,\n\t\"endCursor\": \"\",\n\t\"sort\": {\n\t\t\"fields\": [\n\t\t\t\"UPDATED_AT\"\n\t\t],\n\t\t\"ordering\": \"DESCENDING\"\n\t},\n\t\"filters\": {\n\t\t\"updatedSince\": \"2022-01-01\"\n\t}\n}"
; }
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.UpdateString("query","query GetInvoicesWithFilteringAndOrdering " & @LF & "(" & @LF & " $pageSize: Int" & @LF & " $endCursor: String" & @LF & " $sort: InvoiceSort" & @LF & " $filters: InvoiceFilters" & @LF & "){" & @LF & " invoices(" & @LF & " first: $pageSize" & @LF & " after: $endCursor" & @LF & " filters: $filters" & @LF & " sort: $sort" & @LF & " ) {" & @LF & " totalCount" & @LF & " pageInfo {" & @LF & " ...PageInfoPartial" & @LF & " }" & @LF & " edges {" & @LF & " node {" & @LF & " id" & @LF & " legacyId" & @LF & " createdAt" & @LF & " updatedAt" & @LF & " order {" & @LF & " updatedAt" & @LF & " id" & @LF & " }" & @LF & " statusFlags" & @LF & " lineItems {" & @LF & " id" & @LF & " variantId" & @LF & " variantSku" & @LF & " variantBarcode" & @LF & " variantName" & @LF & " totalCents" & @LF & " }" & @LF & " shipments {" & @LF & " id" & @LF & " dispatchedAt" & @LF & " shippedItems {" & @LF & " id" & @LF & " lineItem {" & @LF & " id" & @LF & " advertTitle" & @LF & " }" & @LF & " }" & @LF & " }" & @LF & " }" & @LF & " }" & @LF & " }" & @LF & "}" & @LF & @LF & "fragment PageInfoPartial on PageInfo {" & @LF & " hasNextPage" & @LF & " endCursor" & @LF & "}" & @LF)
$oJson.UpdateString("variables","{" & @LF & " ""pageSize"": 100," & @LF & " ""endCursor"": """"," & @LF & " ""sort"": {" & @LF & " ""fields"": [" & @LF & " ""UPDATED_AT\@LF & " ]," & @LF & " ""ordering"": ""DESCENDING\@LF & " }," & @LF & " ""filters"": {" & @LF & " ""updatedSince"": ""2022-01-01\@LF & " }" & @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 GetInvoicesWithFilteringAndOrdering \n(\n\t$pageSize: Int\n\t$endCursor: String\n\t$sort: InvoiceSort\n\t$filters: InvoiceFilters\n){\n\tinvoices(\n\t\tfirst: $pageSize\n\t\tafter: $endCursor\n\t\tfilters: $filters\n\t\tsort: $sort\n\t) {\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\tcreatedAt\n\t\t\t\tupdatedAt\n\t\t\t\torder {\n\t\t\t\t\tupdatedAt\n\t\t\t\t\tid\n\t\t\t\t}\n\t\t\t\tstatusFlags\n\t\t\t\tlineItems {\n\t\t\t\t\tid\n\t\t\t\t\tvariantId\n\t\t\t\t\tvariantSku\n\t\t\t\t\tvariantBarcode\n\t\t\t\t\tvariantName\n\t\t\t\t\ttotalCents\n\t\t\t\t}\n\t\t\t\tshipments {\n\t\t\t\t\tid\n\t\t\t\t\tdispatchedAt\n\t\t\t\t\tshippedItems {\n\t\t\t\t\t\tid\n\t\t\t\t\t\tlineItem {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\tadvertTitle\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\": 100,\n\t\"endCursor\": \"\",\n\t\"sort\": {\n\t\t\"fields\": [\n\t\t\t\"UPDATED_AT\"\n\t\t],\n\t\t\"ordering\": \"DESCENDING\"\n\t},\n\t\"filters\": {\n\t\t\"updatedSince\": \"2022-01-01\"\n\t}\n}"}'
https://bestfriendbazaar.com/graphql
Postman Collection Item JSON
{
"name": "Get Invoices with Filtering and Ordering",
"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 GetInvoicesWithFilteringAndOrdering \n(\n\t$pageSize: Int\n\t$endCursor: String\n\t$sort: InvoiceSort\n\t$filters: InvoiceFilters\n){\n\tinvoices(\n\t\tfirst: $pageSize\n\t\tafter: $endCursor\n\t\tfilters: $filters\n\t\tsort: $sort\n\t) {\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\tcreatedAt\n\t\t\t\tupdatedAt\n\t\t\t\torder {\n\t\t\t\t\tupdatedAt\n\t\t\t\t\tid\n\t\t\t\t}\n\t\t\t\tstatusFlags\n\t\t\t\tlineItems {\n\t\t\t\t\tid\n\t\t\t\t\tvariantId\n\t\t\t\t\tvariantSku\n\t\t\t\t\tvariantBarcode\n\t\t\t\t\tvariantName\n\t\t\t\t\ttotalCents\n\t\t\t\t}\n\t\t\t\tshipments {\n\t\t\t\t\tid\n\t\t\t\t\tdispatchedAt\n\t\t\t\t\tshippedItems {\n\t\t\t\t\t\tid\n\t\t\t\t\t\tlineItem {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\tadvertTitle\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\": 100,\n\t\"endCursor\": \"\",\n\t\"sort\": {\n\t\t\"fields\": [\n\t\t\t\"UPDATED_AT\"\n\t\t],\n\t\t\"ordering\": \"DESCENDING\"\n\t},\n\t\"filters\": {\n\t\t\"updatedSince\": \"2022-01-01\"\n\t}\n}"
}
},
"url": {
"raw": "{{base_url}}",
"host": [
"{{base_url}}"
],
"path": null
},
"description": null
},
"response": [
]
}