Chilkat Online Tools

DataFlex / Marketplacer SELLER API / Refund Request Line Item Deny

Back to Collection Items

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vJson
    Handle hoJson
    Variant vResp
    Handle hoResp
    String sTemp1
    Integer iTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Set ComBasicAuth Of hoHttp To True
    Set ComLogin Of hoHttp To "{{username}}"
    Set ComPassword Of hoHttp To "{{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": "mutation RefundRequestLineItemDeny(\n\t$input: RefundRequestLineItemDenyMutationInput!\n) {\n\trefundRequestLineItemDeny(input: $input) {\n\t\terrors {\n\t\t\tfield\n\t\t\tmessages\n\t\t}\n\t}\n}\n",
    //   "variables": "{\n  \"input\": {\n    \"refundRequestLineItemId\": \"UmVmdW5kUmVxdWVzdExpbmVJdGVtLTc5MA==\",\n    \"denyRefundReason\": \"Refund window exceeded\",\n    \"notes\": [\n      {\n        \"note\": \"Refund request went beyone the refund window\"\n      }\n    ]\n  }\n}"
    // }

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComUpdateString Of hoJson "query" "mutation RefundRequestLineItemDeny(" + (character(10)) + "	$input: RefundRequestLineItemDenyMutationInput!" + (character(10)) + ") {" + (character(10)) + "	refundRequestLineItemDeny(input: $input) {" + (character(10)) + "		errors {" + (character(10)) + "			field" + (character(10)) + "			messages" + (character(10)) + "		}" + (character(10)) + "	}" + (character(10)) + "}" + (character(10)) To iSuccess
    Get ComUpdateString Of hoJson "variables" '{' + (character(10)) + '  "input": {' + (character(10)) + '    "refundRequestLineItemId": "UmVmdW5kUmVxdWVzdExpbmVJdGVtLTc5MA==",' + (character(10)) + '    "denyRefundReason": "Refund window exceeded",' + (character(10)) + '    "notes": [' + (character(10)) + '      {' + (character(10)) + '        "note": "Refund request went beyone the refund window\(character(10)) + '      }' + (character(10)) + '    ]' + (character(10)) + '  }' + (character(10)) + '}' To iSuccess

    Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"
    Send ComSetRequestHeader To hoHttp "MARKETPLACER-API-KEY" "{{api_key}}"

    Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
    If (Not(IsComObjectCreated(hoResp))) Begin
        Send CreateComObject of hoResp
    End
    Get pvComObject of hoJson to vJson
    Get pvComObject of hoResp to vResp
    Get ComHttpJson Of hoHttp "POST" "https://bestfriendbazaar.com/graphql" vJson "application/json" vResp To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp To iTemp1
    Showln iTemp1
    Get ComBodyStr Of hoResp To sTemp1
    Showln sTemp1


End_Procedure

Curl Command

curl -X POST
	-u '{{username}}:{{password}}'
	-H "MARKETPLACER-API-KEY: {{api_key}}"
	-H "Content-Type: application/json"
	--data-raw '{"query":"mutation RefundRequestLineItemDeny(\n\t$input: RefundRequestLineItemDenyMutationInput!\n) {\n\trefundRequestLineItemDeny(input: $input) {\n\t\terrors {\n\t\t\tfield\n\t\t\tmessages\n\t\t}\n\t}\n}\n","variables":"{\n  \"input\": {\n    \"refundRequestLineItemId\": \"UmVmdW5kUmVxdWVzdExpbmVJdGVtLTc5MA==\",\n    \"denyRefundReason\": \"Refund window exceeded\",\n    \"notes\": [\n      {\n        \"note\": \"Refund request went beyone the refund window\"\n      }\n    ]\n  }\n}"}'
https://bestfriendbazaar.com/graphql

Postman Collection Item JSON

{
  "name": "Refund Request Line Item Deny",
  "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": "mutation RefundRequestLineItemDeny(\n\t$input: RefundRequestLineItemDenyMutationInput!\n) {\n\trefundRequestLineItemDeny(input: $input) {\n\t\terrors {\n\t\t\tfield\n\t\t\tmessages\n\t\t}\n\t}\n}\n",
        "variables": "{\n  \"input\": {\n    \"refundRequestLineItemId\": \"UmVmdW5kUmVxdWVzdExpbmVJdGVtLTc5MA==\",\n    \"denyRefundReason\": \"Refund window exceeded\",\n    \"notes\": [\n      {\n        \"note\": \"Refund request went beyone the refund window\"\n      }\n    ]\n  }\n}"
      }
    },
    "url": {
      "raw": "{{base_url}}",
      "host": [
        "{{base_url}}"
      ],
      "path": null
    },
    "description": null
  },
  "response": [
  ]
}