unicodeC / APPIA API / EDIT PAYMENT LINK DETAILS
        
        Back to Collection Items
        #include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW json;
    HCkStringBuilderW sbRequestBody;
    HCkHttpResponseW resp;
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.
    http = CkHttpW_Create();
    // Use this online tool to generate code from sample JSON: Generate Code to Create JSON
    // The following JSON is sent in the request body.
    // {
    //   "id": 1,
    //   "link_name": "Facebook Training",
    //   "amount": 200,
    //   "description": "Running a facebook marketing training",
    //   "pin": 1234
    // }
    json = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateInt(json,L"id",1);
    CkJsonObjectW_UpdateString(json,L"link_name",L"Facebook Training");
    CkJsonObjectW_UpdateInt(json,L"amount",200);
    CkJsonObjectW_UpdateString(json,L"description",L"Running a facebook marketing training");
    CkJsonObjectW_UpdateInt(json,L"pin",1234);
    // Adds the "Authorization: Bearer {{auth}}" header.
    CkHttpW_putAuthToken(http,L"{{auth}}");
    CkHttpW_SetRequestHeader(http,L"Content-Type",L"application/json");
    sbRequestBody = CkStringBuilderW_Create();
    CkJsonObjectW_EmitSb(json,sbRequestBody);
    resp = CkHttpResponseW_Create();
    success = CkHttpW_HttpSb(http,L"PUT",L"https://domain.com/plink/",sbRequestBody,L"utf-8",L"application/json",resp);
    if (success == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        CkStringBuilderW_Dispose(sbRequestBody);
        CkHttpResponseW_Dispose(resp);
        return;
    }
    wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
    wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(json);
    CkStringBuilderW_Dispose(sbRequestBody);
    CkHttpResponseW_Dispose(resp);
    }
        Curl Command
        curl -X PUT
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
	-H "Authorization: Bearer {{auth}}"
	-d '{
          "id": 1,
          "link_name": "Facebook Training",
            "amount": 200,
            "description": "Running a facebook marketing training",
            "pin": 1234
}'
https://domain.com/plink/
        Postman Collection Item JSON
        {
  "name": "EDIT PAYMENT LINK DETAILS",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{auth}}",
          "type": "string"
        }
      ]
    },
    "method": "PUT",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Authorization",
        "value": "Bearer {{auth}}"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\r\n          \"id\": 1,\r\n          \"link_name\": \"Facebook Training\",\r\n            \"amount\": 200,\r\n            \"description\": \"Running a facebook marketing training\",\r\n            \"pin\": 1234\r\n}"
    },
    "url": {
      "raw": "{{url}}/plink/",
      "host": [
        "{{url}}"
      ],
      "path": [
        "plink",
        ""
      ]
    }
  },
  "response": [
  ]
}