Chilkat Online Tools

C / Marketplacer SELLER API / Get Remittances by createdSince date

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkJsonObject json;
    HCkHttpResponse resp;

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    http = CkHttp_Create();

    CkHttp_putBasicAuth(http,TRUE);
    CkHttp_putLogin(http,"{{username}}");
    CkHttp_putPassword(http,"{{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}"
    // }

    json = CkJsonObject_Create();
    CkJsonObject_UpdateString(json,"query","query GetRemittancesByCreatedSinceDate(\n	$pageSize: Int\n	$endCursor: String\n	$createdSince: ISO8601DateTime\n) {\n	remittances(\n		first: $pageSize\n		after: $endCursor\n		createdSince: $createdSince\n	) {\n		edges {\n			node {\n				amountCents\n				#This section pulls in invoices based on their remited date\n\n				invoice {\n					id\n					legacyId\n					remittedAt\n					#total remittance= totalCents-comissionAmountCents-merchantFeeCents-shippingCostCents-taxTotalCents\n					totalCents\n					commissionAmountCents\n					merchantFeeCents\n					shippingCostCents\n					taxTotalCents\n					lineItems {\n						id\n						#total remittance= totalCents-comissionAmountCent-postageCents-taxTotalCents\n						totalCents\n						itemAmountCents\n						subtotalCents\n						commissionAmountCents\n						postageCents\n						taxTotalCents\n					}\n				}\n				#This section pulls in amendments based on their remited date\n				invoiceAmendment {\n					id\n					legacyId\n					remittedAt\n					totalCents\n					remittanceCents\n					#this section pulls in the invoice the invoice ammendment is related to so operators could tie the amendments\n					invoice {\n						legacyId\n						remittedAt\n					}\n				}\n			}\n		}\n	}\n}");
    CkJsonObject_UpdateString(json,"variables","{\n  \"pageSize\": 50,\n  \"endCursor\": \"\",\n  \"createdSince\": \"2022-01-22T09:30:46-08:00\"\n}");

    CkHttp_SetRequestHeader(http,"Content-Type","application/json");
    CkHttp_SetRequestHeader(http,"MARKETPLACER-API-KEY","{{api_key}}");

    resp = CkHttp_PostJson3(http,"https://bestfriendbazaar.com/graphql","application/json",json);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(json);
        return;
    }

    printf("%d\n",CkHttpResponse_getStatusCode(resp));
    printf("%s\n",CkHttpResponse_bodyStr(resp));
    CkHttpResponse_Dispose(resp);


    CkHttp_Dispose(http);
    CkJsonObject_Dispose(json);

    }

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": [
  ]
}