Back to Collection Items
var
http: HCkHttp;
success: Boolean;
sbResponseBody: HCkStringBuilder;
jResp: HCkJsonObject;
respStatusCode: Integer;
date_from_at: HCkDtObj;
date_thru_at: HCkDtObj;
description: PWideChar;
cleared_at: PWideChar;
created_at: PWideChar;
hourly_rate: Integer;
id: PWideChar;
note: PWideChar;
v_number: PWideChar;
position_id: PWideChar;
project_id: PWideChar;
login_id: PWideChar;
timer_value: PWideChar;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := CkHttp_Create();
CkHttp_SetRequestHeader(http,'Authorization','{{apiKey}}');
CkHttp_SetRequestHeader(http,'Accept','application/json');
sbResponseBody := CkStringBuilder_Create();
success := CkHttp_QuickGetSb(http,'https://api.easybill.de/rest/v1/time-trackings/:id',sbResponseBody);
if (success = False) then
begin
Memo1.Lines.Add(CkHttp__lastErrorText(http));
Exit;
end;
jResp := CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,False);
Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkJsonObject__emit(jResp));
respStatusCode := CkHttp_getLastStatus(http);
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode >= 400) then
begin
Memo1.Lines.Add('Response Header:');
Memo1.Lines.Add(CkHttp__lastHeader(http));
Memo1.Lines.Add('Failed.');
Exit;
end;
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "description": "<string>",
// "cleared_at": null,
// "created_at": "<dateTime>",
// "date_from_at": null,
// "date_thru_at": null,
// "hourly_rate": 0,
// "id": "<long>",
// "note": null,
// "number": "<string>",
// "position_id": null,
// "project_id": null,
// "login_id": "<long>",
// "timer_value": null
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
date_from_at := CkDtObj_Create();
date_thru_at := CkDtObj_Create();
description := CkJsonObject__stringOf(jResp,'description');
cleared_at := CkJsonObject__stringOf(jResp,'cleared_at');
created_at := CkJsonObject__stringOf(jResp,'created_at');
CkJsonObject_DtOf(jResp,'date_from_at',False,date_from_at);
CkJsonObject_DtOf(jResp,'date_thru_at',False,date_thru_at);
hourly_rate := CkJsonObject_IntOf(jResp,'hourly_rate');
id := CkJsonObject__stringOf(jResp,'id');
note := CkJsonObject__stringOf(jResp,'note');
v_number := CkJsonObject__stringOf(jResp,'number');
position_id := CkJsonObject__stringOf(jResp,'position_id');
project_id := CkJsonObject__stringOf(jResp,'project_id');
login_id := CkJsonObject__stringOf(jResp,'login_id');
timer_value := CkJsonObject__stringOf(jResp,'timer_value');
CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
CkDtObj_Dispose(date_from_at);
CkDtObj_Dispose(date_thru_at);
Curl Command
curl -X GET
-H "Authorization: {{apiKey}}"
-H "Accept: application/json"
https://api.easybill.de/rest/v1/time-trackings/:id
Postman Collection Item JSON
{
"name": "Fetch time tracking",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/time-trackings/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"time-trackings",
":id"
],
"variable": [
{
"key": "id",
"value": "<long>",
"description": "(Required) ID of time tracking"
}
]
}
},
"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}}/time-trackings/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"time-trackings",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"description\": \"<string>\",\n \"cleared_at\": null,\n \"created_at\": \"<dateTime>\",\n \"date_from_at\": null,\n \"date_thru_at\": null,\n \"hourly_rate\": 0,\n \"id\": \"<long>\",\n \"note\": null,\n \"number\": \"<string>\",\n \"position_id\": null,\n \"project_id\": null,\n \"login_id\": \"<long>\",\n \"timer_value\": null\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}}/time-trackings/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"time-trackings",
":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}}/time-trackings/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"time-trackings",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}