Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sId
String sDocument_id
String sV_to
String sCc
String sFrom
String sSubject
String sMessage
String sDate
String sCreated_at
String sProcessed_at
String sSend_by_self
String sSend_with_attachment
String sV_type
String sStatus
String sStatus_msg
String sLogin_id
String sDocument_file_type
String sPost_send_type
String sTracking_identifier
String sTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Send ComSetRequestHeader To hoHttp "Authorization" "{{apiKey}}"
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComQuickGetSb Of hoHttp "https://api.easybill.de/rest/v1/post-boxes/:id" vSbResponseBody To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
Set ComEmitCompact Of hoJResp To False
Showln "Response Body:"
Get ComEmit Of hoJResp To sTemp1
Showln sTemp1
Get ComLastStatus Of hoHttp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComLastHeader Of hoHttp To sTemp1
Showln sTemp1
Showln "Failed."
Procedure_Return
End
// 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
Get ComStringOf Of hoJResp "id" To sId
Get ComStringOf Of hoJResp "document_id" To sDocument_id
Get ComStringOf Of hoJResp "to" To sV_to
Get ComStringOf Of hoJResp "cc" To sCc
Get ComStringOf Of hoJResp "from" To sFrom
Get ComStringOf Of hoJResp "subject" To sSubject
Get ComStringOf Of hoJResp "message" To sMessage
Get ComStringOf Of hoJResp "date" To sDate
Get ComStringOf Of hoJResp "created_at" To sCreated_at
Get ComStringOf Of hoJResp "processed_at" To sProcessed_at
Get ComStringOf Of hoJResp "send_by_self" To sSend_by_self
Get ComStringOf Of hoJResp "send_with_attachment" To sSend_with_attachment
Get ComStringOf Of hoJResp "type" To sV_type
Get ComStringOf Of hoJResp "status" To sStatus
Get ComStringOf Of hoJResp "status_msg" To sStatus_msg
Get ComStringOf Of hoJResp "login_id" To sLogin_id
Get ComStringOf Of hoJResp "document_file_type" To sDocument_file_type
Get ComStringOf Of hoJResp "post_send_type" To sPost_send_type
Get ComStringOf Of hoJResp "tracking_identifier" To sTracking_identifier
End_Procedure
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": ""
}
]
}