Chilkat Online Tools

Xojo / Marketplacer SELLER API / Get Remittances by createdSince date

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 GetRemittancesByCreatedSinceDate(\n\t$pageSize: Int\n\t$endCursor: String\n\t$createdSince: ISO8601DateTime\n) {\n\tremittances(\n\t\tfirst: $pageSize\n\t\tafter: $endCursor\n\t\tcreatedSince: $createdSince\n\t) {\n\t\tedges {\n\t\t\tnode {\n\t\t\t\tamountCents\n\t\t\t\t#This section pulls in invoices based on their remited date\n\n\t\t\t\tinvoice {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\t#total remittance= totalCents-comissionAmountCents-merchantFeeCents-shippingCostCents-taxTotalCents\n\t\t\t\t\ttotalCents\n\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\tmerchantFeeCents\n\t\t\t\t\tshippingCostCents\n\t\t\t\t\ttaxTotalCents\n\t\t\t\t\tlineItems {\n\t\t\t\t\t\tid\n\t\t\t\t\t\t#total remittance= totalCents-comissionAmountCent-postageCents-taxTotalCents\n\t\t\t\t\t\ttotalCents\n\t\t\t\t\t\titemAmountCents\n\t\t\t\t\t\tsubtotalCents\n\t\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\t\tpostageCents\n\t\t\t\t\t\ttaxTotalCents\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#This section pulls in amendments based on their remited date\n\t\t\t\tinvoiceAmendment {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\ttotalCents\n\t\t\t\t\tremittanceCents\n\t\t\t\t\t#this section pulls in the invoice the invoice ammendment is related to so operators could tie the amendments\n\t\t\t\t\tinvoice {\n\t\t\t\t\t\tlegacyId\n\t\t\t\t\t\tremittedAt\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
//   "variables": "{\n  \"pageSize\": 50,\n  \"endCursor\": \"\",\n  \"createdSince\": \"2022-01-22T09:30:46-08:00\"\n}"
// }

Dim json As New Chilkat.JsonObject
success = json.UpdateString("query","query GetRemittancesByCreatedSinceDate(" + EndOfLine.Unix + "	$pageSize: Int" + EndOfLine.Unix + "	$endCursor: String" + EndOfLine.Unix + "	$createdSince: ISO8601DateTime" + EndOfLine.Unix + ") {" + EndOfLine.Unix + "	remittances(" + EndOfLine.Unix + "		first: $pageSize" + EndOfLine.Unix + "		after: $endCursor" + EndOfLine.Unix + "		createdSince: $createdSince" + EndOfLine.Unix + "	) {" + EndOfLine.Unix + "		edges {" + EndOfLine.Unix + "			node {" + EndOfLine.Unix + "				amountCents" + EndOfLine.Unix + "				#This section pulls in invoices based on their remited date" + EndOfLine.Unix + EndOfLine.Unix + "				invoice {" + EndOfLine.Unix + "					id" + EndOfLine.Unix + "					legacyId" + EndOfLine.Unix + "					remittedAt" + EndOfLine.Unix + "					#total remittance= totalCents-comissionAmountCents-merchantFeeCents-shippingCostCents-taxTotalCents" + EndOfLine.Unix + "					totalCents" + EndOfLine.Unix + "					commissionAmountCents" + EndOfLine.Unix + "					merchantFeeCents" + EndOfLine.Unix + "					shippingCostCents" + EndOfLine.Unix + "					taxTotalCents" + EndOfLine.Unix + "					lineItems {" + EndOfLine.Unix + "						id" + EndOfLine.Unix + "						#total remittance= totalCents-comissionAmountCent-postageCents-taxTotalCents" + EndOfLine.Unix + "						totalCents" + EndOfLine.Unix + "						itemAmountCents" + EndOfLine.Unix + "						subtotalCents" + EndOfLine.Unix + "						commissionAmountCents" + EndOfLine.Unix + "						postageCents" + EndOfLine.Unix + "						taxTotalCents" + EndOfLine.Unix + "					}" + EndOfLine.Unix + "				}" + EndOfLine.Unix + "				#This section pulls in amendments based on their remited date" + EndOfLine.Unix + "				invoiceAmendment {" + EndOfLine.Unix + "					id" + EndOfLine.Unix + "					legacyId" + EndOfLine.Unix + "					remittedAt" + EndOfLine.Unix + "					totalCents" + EndOfLine.Unix + "					remittanceCents" + EndOfLine.Unix + "					#this section pulls in the invoice the invoice ammendment is related to so operators could tie the amendments" + EndOfLine.Unix + "					invoice {" + EndOfLine.Unix + "						legacyId" + EndOfLine.Unix + "						remittedAt" + EndOfLine.Unix + "					}" + EndOfLine.Unix + "				}" + EndOfLine.Unix + "			}" + EndOfLine.Unix + "		}" + EndOfLine.Unix + "	}" + EndOfLine.Unix + "}")
success = json.UpdateString("variables","{" + EndOfLine.Unix + "  ""pageSize"": 50," + EndOfLine.Unix + "  ""endCursor"": """"," + EndOfLine.Unix + "  ""createdSince"": ""2022-01-22T09:30:46-08:00\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 GetRemittancesByCreatedSinceDate(\n\t$pageSize: Int\n\t$endCursor: String\n\t$createdSince: ISO8601DateTime\n) {\n\tremittances(\n\t\tfirst: $pageSize\n\t\tafter: $endCursor\n\t\tcreatedSince: $createdSince\n\t) {\n\t\tedges {\n\t\t\tnode {\n\t\t\t\tamountCents\n\t\t\t\t#This section pulls in invoices based on their remited date\n\n\t\t\t\tinvoice {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\t#total remittance= totalCents-comissionAmountCents-merchantFeeCents-shippingCostCents-taxTotalCents\n\t\t\t\t\ttotalCents\n\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\tmerchantFeeCents\n\t\t\t\t\tshippingCostCents\n\t\t\t\t\ttaxTotalCents\n\t\t\t\t\tlineItems {\n\t\t\t\t\t\tid\n\t\t\t\t\t\t#total remittance= totalCents-comissionAmountCent-postageCents-taxTotalCents\n\t\t\t\t\t\ttotalCents\n\t\t\t\t\t\titemAmountCents\n\t\t\t\t\t\tsubtotalCents\n\t\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\t\tpostageCents\n\t\t\t\t\t\ttaxTotalCents\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#This section pulls in amendments based on their remited date\n\t\t\t\tinvoiceAmendment {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\ttotalCents\n\t\t\t\t\tremittanceCents\n\t\t\t\t\t#this section pulls in the invoice the invoice ammendment is related to so operators could tie the amendments\n\t\t\t\t\tinvoice {\n\t\t\t\t\t\tlegacyId\n\t\t\t\t\t\tremittedAt\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}","variables":"{\n  \"pageSize\": 50,\n  \"endCursor\": \"\",\n  \"createdSince\": \"2022-01-22T09:30:46-08:00\"\n}"}'
https://bestfriendbazaar.com/graphql

Postman Collection Item JSON

{
  "name": "Get Remittances by createdSince date",
  "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 GetRemittancesByCreatedSinceDate(\n\t$pageSize: Int\n\t$endCursor: String\n\t$createdSince: ISO8601DateTime\n) {\n\tremittances(\n\t\tfirst: $pageSize\n\t\tafter: $endCursor\n\t\tcreatedSince: $createdSince\n\t) {\n\t\tedges {\n\t\t\tnode {\n\t\t\t\tamountCents\n\t\t\t\t#This section pulls in invoices based on their remited date\n\n\t\t\t\tinvoice {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\t#total remittance= totalCents-comissionAmountCents-merchantFeeCents-shippingCostCents-taxTotalCents\n\t\t\t\t\ttotalCents\n\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\tmerchantFeeCents\n\t\t\t\t\tshippingCostCents\n\t\t\t\t\ttaxTotalCents\n\t\t\t\t\tlineItems {\n\t\t\t\t\t\tid\n\t\t\t\t\t\t#total remittance= totalCents-comissionAmountCent-postageCents-taxTotalCents\n\t\t\t\t\t\ttotalCents\n\t\t\t\t\t\titemAmountCents\n\t\t\t\t\t\tsubtotalCents\n\t\t\t\t\t\tcommissionAmountCents\n\t\t\t\t\t\tpostageCents\n\t\t\t\t\t\ttaxTotalCents\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#This section pulls in amendments based on their remited date\n\t\t\t\tinvoiceAmendment {\n\t\t\t\t\tid\n\t\t\t\t\tlegacyId\n\t\t\t\t\tremittedAt\n\t\t\t\t\ttotalCents\n\t\t\t\t\tremittanceCents\n\t\t\t\t\t#this section pulls in the invoice the invoice ammendment is related to so operators could tie the amendments\n\t\t\t\t\tinvoice {\n\t\t\t\t\t\tlegacyId\n\t\t\t\t\t\tremittedAt\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
        "variables": "{\n  \"pageSize\": 50,\n  \"endCursor\": \"\",\n  \"createdSince\": \"2022-01-22T09:30:46-08:00\"\n}"
      }
    },
    "url": {
      "raw": "{{base_url}}",
      "host": [
        "{{base_url}}"
      ],
      "path": null
    },
    "description": null
  },
  "response": [
  ]
}