VB6 / 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.
Dim http As New ChilkatHttp
Dim success As Long
http.BasicAuth = 1
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 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}"
' }
Dim json As New ChilkatJsonObject
success = json.UpdateString("query","query GetInvoicesWithFilteringAndOrdering " & vbLf & "(" & vbLf & " $pageSize: Int" & vbLf & " $endCursor: String" & vbLf & " $sort: InvoiceSort" & vbLf & " $filters: InvoiceFilters" & vbLf & "){" & vbLf & " invoices(" & vbLf & " first: $pageSize" & vbLf & " after: $endCursor" & vbLf & " filters: $filters" & vbLf & " sort: $sort" & vbLf & " ) {" & vbLf & " totalCount" & vbLf & " pageInfo {" & vbLf & " ...PageInfoPartial" & vbLf & " }" & vbLf & " edges {" & vbLf & " node {" & vbLf & " id" & vbLf & " legacyId" & vbLf & " createdAt" & vbLf & " updatedAt" & vbLf & " order {" & vbLf & " updatedAt" & vbLf & " id" & vbLf & " }" & vbLf & " statusFlags" & vbLf & " lineItems {" & vbLf & " id" & vbLf & " variantId" & vbLf & " variantSku" & vbLf & " variantBarcode" & vbLf & " variantName" & vbLf & " totalCents" & vbLf & " }" & vbLf & " shipments {" & vbLf & " id" & vbLf & " dispatchedAt" & vbLf & " shippedItems {" & vbLf & " id" & vbLf & " lineItem {" & vbLf & " id" & vbLf & " advertTitle" & vbLf & " }" & vbLf & " }" & vbLf & " }" & vbLf & " }" & vbLf & " }" & vbLf & " }" & vbLf & "}" & vbLf & vbLf & "fragment PageInfoPartial on PageInfo {" & vbLf & " hasNextPage" & vbLf & " endCursor" & vbLf & "}" & vbLf)
success = json.UpdateString("variables","{" & vbLf & " ""pageSize"": 100," & vbLf & " ""endCursor"": """"," & vbLf & " ""sort"": {" & vbLf & " ""fields"": [" & vbLf & " ""UPDATED_AT\vbLf & " ]," & vbLf & " ""ordering"": ""DESCENDING\vbLf & " }," & vbLf & " ""filters"": {" & vbLf & " ""updatedSince"": ""2022-01-01\vbLf & " }" & vbLf & "}")
http.SetRequestHeader "Content-Type","application/json"
http.SetRequestHeader "MARKETPLACER-API-KEY","{{api_key}}"
Dim resp As ChilkatHttpResponse
Set resp = http.PostJson3("https://bestfriendbazaar.com/graphql","application/json",json)
If (http.LastMethodSuccess = 0) Then
Debug.Print http.LastErrorText
Exit Sub
End If
Debug.Print resp.StatusCode
Debug.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 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": [
]
}