Back to Collection Items
#import <CkoHttp.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>
#import <NSString.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;
[http SetRequestHeader: @"Authorization" value: @"{{apiKey}}"];
[http SetRequestHeader: @"Accept" value: @"application/json"];
CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
success = [http QuickGetSb: @"https://api.easybill.de/rest/v1/post-boxes/:id" sbContent: sbResponseBody];
if (success == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
CkoJsonObject *jResp = [[CkoJsonObject alloc] init];
[jResp LoadSb: sbResponseBody];
jResp.EmitCompact = NO;
NSLog(@"%@",@"Response Body:");
NSLog(@"%@",[jResp Emit]);
int respStatusCode = [http.LastStatus intValue];
NSLog(@"%@%d",@"Response Status Code = ",respStatusCode);
if (respStatusCode >= 400) {
NSLog(@"%@",@"Response Header:");
NSLog(@"%@",http.LastHeader);
NSLog(@"%@",@"Failed.");
return;
}
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "id": "<long>",
// "document_id": "<long>",
// "to": "<string>",
// "cc": "<string>",
// "from": "<string>",
// "subject": "<string>",
// "message": "<string>",
// "date": "<date>",
// "created_at": "<dateTime>",
// "processed_at": "<dateTime>",
// "send_by_self": "<boolean>",
// "send_with_attachment": "<boolean>",
// "type": "EMAIL",
// "status": "PROCESSING",
// "status_msg": "<string>",
// "login_id": "<long>",
// "document_file_type": "default",
// "post_send_type": "post_send_type_registered",
// "tracking_identifier": "<string>"
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
NSString *id = [jResp StringOf: @"id"];
NSString *document_id = [jResp StringOf: @"document_id"];
NSString *v_to = [jResp StringOf: @"to"];
NSString *cc = [jResp StringOf: @"cc"];
NSString *from = [jResp StringOf: @"from"];
NSString *subject = [jResp StringOf: @"subject"];
NSString *message = [jResp StringOf: @"message"];
NSString *date = [jResp StringOf: @"date"];
NSString *created_at = [jResp StringOf: @"created_at"];
NSString *processed_at = [jResp StringOf: @"processed_at"];
NSString *send_by_self = [jResp StringOf: @"send_by_self"];
NSString *send_with_attachment = [jResp StringOf: @"send_with_attachment"];
NSString *v_type = [jResp StringOf: @"type"];
NSString *status = [jResp StringOf: @"status"];
NSString *status_msg = [jResp StringOf: @"status_msg"];
NSString *login_id = [jResp StringOf: @"login_id"];
NSString *document_file_type = [jResp StringOf: @"document_file_type"];
NSString *post_send_type = [jResp StringOf: @"post_send_type"];
NSString *tracking_identifier = [jResp StringOf: @"tracking_identifier"];
Curl Command
curl -X GET
-H "Authorization: {{apiKey}}"
-H "Accept: application/json"
https://api.easybill.de/rest/v1/post-boxes/:id
Postman Collection Item JSON
{
"name": "Fetch post box",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/post-boxes/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"post-boxes",
":id"
],
"variable": [
{
"key": "id",
"value": "<long>",
"description": "(Required) ID of post box"
}
]
}
},
"response": [
{
"name": "Successful operation",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/post-boxes/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"post-boxes",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"id\": \"<long>\",\n \"document_id\": \"<long>\",\n \"to\": \"<string>\",\n \"cc\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"date\": \"<date>\",\n \"created_at\": \"<dateTime>\",\n \"processed_at\": \"<dateTime>\",\n \"send_by_self\": \"<boolean>\",\n \"send_with_attachment\": \"<boolean>\",\n \"type\": \"EMAIL\",\n \"status\": \"PROCESSING\",\n \"status_msg\": \"<string>\",\n \"login_id\": \"<long>\",\n \"document_file_type\": \"default\",\n \"post_send_type\": \"post_send_type_registered\",\n \"tracking_identifier\": \"<string>\"\n}"
},
{
"name": "Not found",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/post-boxes/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"post-boxes",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
},
{
"name": "Too Many Requests",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/post-boxes/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"post-boxes",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}