Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loHttp = createobject("CkHttp")
loHttp.SetRequestHeader("Authorization","{{apiKey}}")
loHttp.SetRequestHeader("Accept","application/json")
loSbResponseBody = createobject("CkStringBuilder")
llSuccess = loHttp.QuickGetSb("https://api.easybill.de/rest/v1/positions/:id",loSbResponseBody)
if (llSuccess = .F.) then
? loHttp.LastErrorText
release loHttp
release loSbResponseBody
return
endif
loJResp = createobject("CkJsonObject")
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = .F.
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + str(lnRespStatusCode)
if (lnRespStatusCode >= 400) then
? "Response Header:"
? loHttp.LastHeader
? "Failed."
release loHttp
release loSbResponseBody
release loJResp
return
endif
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "number": "<string>",
// "description": "<string>",
// "sale_price": "<float>",
// "id": "<long>",
// "type": "PRODUCT",
// "document_note": "<string>",
// "note": null,
// "unit": null,
// "export_identifier": null,
// "export_identifier_extended": {
// "NULL": null,
// "nStb": null,
// "nStbUstID": null,
// "nStbNoneUstID": null,
// "nStbIm": null,
// "revc": null,
// "IG": null,
// "AL": null,
// "sStfr": null,
// "smallBusiness": null
// },
// "login_id": "<long>",
// "price_type": "NETTO",
// "vat_percent": 19,
// "sale_price2": null,
// "sale_price3": null,
// "sale_price4": null,
// "sale_price5": null,
// "sale_price6": null,
// "sale_price7": null,
// "sale_price8": null,
// "sale_price9": null,
// "sale_price10": null,
// "cost_price": "<float>",
// "export_cost1": null,
// "export_cost2": null,
// "group_id": "<long>",
// "stock": "NO",
// "stock_count": 0,
// "stock_limit_notify": false,
// "stock_limit_notify_frequency": "ALWAYS",
// "stock_limit": 0,
// "quantity": null,
// "archived": false
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
lcV_number = loJResp.StringOf("number")
lcDescription = loJResp.StringOf("description")
lcSale_price = loJResp.StringOf("sale_price")
lcId = loJResp.StringOf("id")
lcV_type = loJResp.StringOf("type")
lcDocument_note = loJResp.StringOf("document_note")
lcNote = loJResp.StringOf("note")
lcUnit = loJResp.StringOf("unit")
lcExport_identifier = loJResp.StringOf("export_identifier")
lcV_NULL = loJResp.StringOf("export_identifier_extended.NULL")
lcNStb = loJResp.StringOf("export_identifier_extended.nStb")
lcNStbUstID = loJResp.StringOf("export_identifier_extended.nStbUstID")
lcNStbNoneUstID = loJResp.StringOf("export_identifier_extended.nStbNoneUstID")
lcNStbIm = loJResp.StringOf("export_identifier_extended.nStbIm")
lcRevc = loJResp.StringOf("export_identifier_extended.revc")
lcIG = loJResp.StringOf("export_identifier_extended.IG")
lcAL = loJResp.StringOf("export_identifier_extended.AL")
lcSStfr = loJResp.StringOf("export_identifier_extended.sStfr")
lcSmallBusiness = loJResp.StringOf("export_identifier_extended.smallBusiness")
lcLogin_id = loJResp.StringOf("login_id")
lcPrice_type = loJResp.StringOf("price_type")
lnVat_percent = loJResp.IntOf("vat_percent")
lcSale_price2 = loJResp.StringOf("sale_price2")
lcSale_price3 = loJResp.StringOf("sale_price3")
lcSale_price4 = loJResp.StringOf("sale_price4")
lcSale_price5 = loJResp.StringOf("sale_price5")
lcSale_price6 = loJResp.StringOf("sale_price6")
lcSale_price7 = loJResp.StringOf("sale_price7")
lcSale_price8 = loJResp.StringOf("sale_price8")
lcSale_price9 = loJResp.StringOf("sale_price9")
lcSale_price10 = loJResp.StringOf("sale_price10")
lcCost_price = loJResp.StringOf("cost_price")
lcExport_cost1 = loJResp.StringOf("export_cost1")
lcExport_cost2 = loJResp.StringOf("export_cost2")
lcGroup_id = loJResp.StringOf("group_id")
lcStock = loJResp.StringOf("stock")
lnStock_count = loJResp.IntOf("stock_count")
llStock_limit_notify = loJResp.BoolOf("stock_limit_notify")
lcStock_limit_notify_frequency = loJResp.StringOf("stock_limit_notify_frequency")
lnStock_limit = loJResp.IntOf("stock_limit")
lcQuantity = loJResp.StringOf("quantity")
llArchived = loJResp.BoolOf("archived")
release loHttp
release loSbResponseBody
release loJResp
Curl Command
curl -X GET
-H "Authorization: {{apiKey}}"
-H "Accept: application/json"
https://api.easybill.de/rest/v1/positions/:id
Postman Collection Item JSON
{
"name": "Fetch position",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/positions/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"positions",
":id"
],
"variable": [
{
"key": "id",
"value": "<long>",
"description": "(Required) ID of position"
}
]
}
},
"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}}/positions/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"positions",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"number\": \"<string>\",\n \"description\": \"<string>\",\n \"sale_price\": \"<float>\",\n \"id\": \"<long>\",\n \"type\": \"PRODUCT\",\n \"document_note\": \"<string>\",\n \"note\": null,\n \"unit\": null,\n \"export_identifier\": null,\n \"export_identifier_extended\": {\n \"NULL\": null,\n \"nStb\": null,\n \"nStbUstID\": null,\n \"nStbNoneUstID\": null,\n \"nStbIm\": null,\n \"revc\": null,\n \"IG\": null,\n \"AL\": null,\n \"sStfr\": null,\n \"smallBusiness\": null\n },\n \"login_id\": \"<long>\",\n \"price_type\": \"NETTO\",\n \"vat_percent\": 19,\n \"sale_price2\": null,\n \"sale_price3\": null,\n \"sale_price4\": null,\n \"sale_price5\": null,\n \"sale_price6\": null,\n \"sale_price7\": null,\n \"sale_price8\": null,\n \"sale_price9\": null,\n \"sale_price10\": null,\n \"cost_price\": \"<float>\",\n \"export_cost1\": null,\n \"export_cost2\": null,\n \"group_id\": \"<long>\",\n \"stock\": \"NO\",\n \"stock_count\": 0,\n \"stock_limit_notify\": false,\n \"stock_limit_notify_frequency\": \"ALWAYS\",\n \"stock_limit\": 0,\n \"quantity\": null,\n \"archived\": false\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}}/positions/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"positions",
":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}}/positions/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"positions",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}