Back to Collection Items
#import <CkoHttp.h>
#import <CkoJsonObject.h>
#import <CkoStringBuilder.h>
#import <CkoHttpResponse.h>
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoHttp *http = [[CkoHttp alloc] init];
BOOL success;
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "first_name": "test1",
// "last_name": "test1",
// "company": "test1",
// "job_title": "test1",
// "phone": "test1",
// "country": "test1",
// "state": "test1",
// "street_address": "test1",
// "city": "test1",
// "postal_code": "test1"
// }
CkoJsonObject *json = [[CkoJsonObject alloc] init];
[json UpdateString: @"first_name" value: @"test1"];
[json UpdateString: @"last_name" value: @"test1"];
[json UpdateString: @"company" value: @"test1"];
[json UpdateString: @"job_title" value: @"test1"];
[json UpdateString: @"phone" value: @"test1"];
[json UpdateString: @"country" value: @"test1"];
[json UpdateString: @"state" value: @"test1"];
[json UpdateString: @"street_address" value: @"test1"];
[json UpdateString: @"city" value: @"test1"];
[json UpdateString: @"postal_code" value: @"test1"];
// Adds the "Authorization: Bearer {{access_token}}" header.
http.AuthToken = @"{{access_token}}";
CkoStringBuilder *sbRequestBody = [[CkoStringBuilder alloc] init];
[json EmitSb: sbRequestBody];
CkoHttpResponse *resp = [http PTextSb: @"PATCH" url: @"https://api.pandadoc.com/public/v1/contacts/{{contact_id}}/" textData: sbRequestBody charset: @"utf-8" contentType: @"application/json" md5: NO gzip: NO];
if (http.LastMethodSuccess == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
NSLog(@"%d",[resp.StatusCode intValue]);
NSLog(@"%@",resp.BodyStr);
Curl Command
curl -X PATCH
-H "Authorization: API-Key {{api_key}}"
-H "Authorization: Bearer {{access_token}}"
-d '{
"first_name": "test1",
"last_name": "test1",
"company": "test1",
"job_title": "test1",
"phone": "test1",
"country":"test1",
"state":"test1",
"street_address":"test1",
"city":"test1",
"postal_code":"test1"
}'
https://api.pandadoc.com/public/v1/contacts/{{contact_id}}/
Postman Collection Item JSON
{
"name": "Update Contact",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PATCH",
"header": [
{
"key": "Authorization",
"value": "API-Key {{api_key}}",
"type": "text"
},
{
"key": "Authorization",
"value": "Bearer {{access_token}}",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "{\n \"first_name\": \"test1\",\n \"last_name\": \"test1\",\n \"company\": \"test1\",\n \"job_title\": \"test1\",\n \"phone\": \"test1\",\n \"country\":\"test1\",\n \"state\":\"test1\",\n \"street_address\":\"test1\",\n \"city\":\"test1\",\n \"postal_code\":\"test1\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.pandadoc.com/public/v1/contacts/{{contact_id}}/",
"protocol": "https",
"host": [
"api",
"pandadoc",
"com"
],
"path": [
"public",
"v1",
"contacts",
"{{contact_id}}",
""
]
}
},
"response": [
]
}