C / easybill REST API / Download a document as an jpeg-image
Back to Collection Items
#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>
void ChilkatSample(void)
{
HCkHttp http;
BOOL success;
HCkJsonObject queryParams;
HCkHttpResponse resp;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttp_Create();
queryParams = CkJsonObject_Create();
CkJsonObject_UpdateString(queryParams,"offset","<long>");
CkJsonObject_UpdateString(queryParams,"limit","<long>");
CkHttp_SetRequestHeader(http,"Authorization","{{apiKey}}");
CkHttp_SetRequestHeader(http,"Accept","image/jpeg");
resp = CkHttp_QuickRequestParams(http,"GET","https://api.easybill.de/rest/v1/documents/:id/jpg",queryParams);
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
CkJsonObject_Dispose(queryParams);
return;
}
ERROR: "=" expected
ERROR: Undefined variable(ERROR)
CkHttp_Dispose(http);
CkJsonObject_Dispose(queryParams);
}
Curl Command
curl -G -d "offset=%3Clong%3E"
-d "limit=%3Clong%3E"
-H "Authorization: {{apiKey}}"
-H "Accept: image/jpeg"
https://api.easybill.de/rest/v1/documents/:id/jpg
Postman Collection Item JSON
{
"name": "Download a document as an jpeg-image",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "image/jpeg"
}
],
"url": {
"raw": "{{baseUrl}}/documents/:id/jpg?offset=<long>&limit=<long>",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
"jpg"
],
"query": [
{
"key": "offset",
"value": "<long>",
"description": "The page of the document where the image should start."
},
{
"key": "limit",
"value": "<long>",
"description": "The page of the document where the image should end."
}
],
"variable": [
{
"key": "id",
"value": "<long>",
"description": "(Required) ID of document"
}
]
}
},
"response": [
{
"name": "Successful operation",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "image/jpeg"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/documents/:id/jpg?offset=<long>&limit=<long>",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
"jpg"
],
"query": [
{
"key": "offset",
"value": "<long>",
"description": "The page of the document where the image should start."
},
{
"key": "limit",
"value": "<long>",
"description": "The page of the document where the image should end."
}
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "image/jpeg"
}
],
"cookie": [
],
"body": "<string>"
},
{
"name": "Not found",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/documents/:id/jpg?offset=<long>&limit=<long>",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
"jpg"
],
"query": [
{
"key": "offset",
"value": "<long>",
"description": "The page of the document where the image should start."
},
{
"key": "limit",
"value": "<long>",
"description": "The page of the document where the image should end."
}
],
"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}}/documents/:id/jpg?offset=<long>&limit=<long>",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
"jpg"
],
"query": [
{
"key": "offset",
"value": "<long>",
"description": "The page of the document where the image should start."
},
{
"key": "limit",
"value": "<long>",
"description": "The page of the document where the image should end."
}
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}