Objective-C / WAC API / Enable FTP
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.
// {
// "EnableFTP": true
// }
CkoJsonObject *json = [[CkoJsonObject alloc] init];
[json UpdateBool: @"EnableFTP" value: YES];
[http SetRequestHeader: @"Authorization" value: @"{{WACApiKey}}"];
CkoHttpResponse *resp = [http PostJson3: @"https://domain.com/v1/accounts/:AcctNum" 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 "Authorization: {{WACApiKey}}"
-d '{
"EnableFTP": true
}'
https://domain.com/v1/accounts/:AcctNum
Postman Collection Item JSON
{
"name": "Enable FTP",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "{{WACApiKey}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"EnableFTP\": true\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseURL}}/v1/accounts/:AcctNum",
"host": [
"{{baseURL}}"
],
"path": [
"v1",
"accounts",
":AcctNum"
],
"variable": [
{
"key": "AcctNum",
"value": "",
"description": "Account Number"
}
]
}
},
"response": [
]
}