Objective-C / DocuSign REST API / 14. Created Embedded View
Back to Collection Items
#import <CkoHttp.h>
#import <CkoJsonObject.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.
// {
// "returnUrl": "http://httpbin.org/get",
// "authenticationMethod": "none",
// "email": "{{email}}",
// "userName": "{{userName}}"
// }
CkoJsonObject *json = [[CkoJsonObject alloc] init];
[json UpdateString: @"returnUrl" value: @"http://httpbin.org/get"];
[json UpdateString: @"authenticationMethod" value: @"none"];
[json UpdateString: @"email" value: @"{{email}}"];
[json UpdateString: @"userName" value: @"{{userName}}"];
[http SetRequestHeader: @"Content-Type" value: @"application/json"];
// Adds the "Authorization: Bearer {{accessToken}}" header.
http.AuthToken = @"{{accessToken}}";
CkoHttpResponse *resp = [http PostJson3: @"https://domain.com/{{apiVersion}}/accounts/{{accountId}}/envelopes/{{envelopeId_draft}}/views/recipient_preview" contentType: @"application/json" json: json];
if (http.LastMethodSuccess == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
NSLog(@"%d",[resp.StatusCode intValue]);
NSLog(@"%@",resp.BodyStr);
Curl Command
curl -X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer {{accessToken}}"
-d '{
"returnUrl": "http://httpbin.org/get",
"authenticationMethod": "none",
"email": {{user1_email}},
"userName": {{user1_name}}
}'
https://domain.com/{{apiVersion}}/accounts/{{accountId}}/envelopes/{{envelopeId_draft}}/views/recipient_preview
Postman Collection Item JSON
{
"name": "14. Created Embedded View",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"returnUrl\": \"http://httpbin.org/get\",\n \"authenticationMethod\": \"none\",\n \"email\": {{user1_email}},\n \"userName\": {{user1_name}}\n}"
},
"url": {
"raw": "{{baseUrl}}/{{apiVersion}}/accounts/{{accountId}}/envelopes/{{envelopeId_draft}}/views/recipient_preview",
"host": [
"{{baseUrl}}"
],
"path": [
"{{apiVersion}}",
"accounts",
"{{accountId}}",
"envelopes",
"{{envelopeId_draft}}",
"views",
"recipient_preview"
]
},
"description": "In this example, we will create an embedded preview of what our recipients see when the envelope is sent out to them."
},
"response": [
]
}