Chilkat Online Tools

PowerBuilder / easybill REST API / Fetch positions list

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_V_number
string ls_Description
string ls_Sale_price
string ls_Id
string ls_V_type
string ls_Document_note
string ls_Note
string ls_Unit
string ls_Export_identifier
string ls_V_NULL
string ls_NStb
string ls_NStbUstID
string ls_NStbNoneUstID
string ls_NStbIm
string ls_Revc
string ls_IG
string ls_AL
string ls_SStfr
string ls_SmallBusiness
string ls_Login_id
string ls_Price_type
integer li_Vat_percent
string ls_Sale_price2
string ls_Sale_price3
string ls_Sale_price4
string ls_Sale_price5
string ls_Sale_price6
string ls_Sale_price7
string ls_Sale_price8
string ls_Sale_price9
string ls_Sale_price10
string ls_Cost_price
string ls_Export_cost1
string ls_Export_cost2
string ls_Group_id
string ls_Stock
integer li_Stock_count
integer li_Stock_limit_notify
string ls_Stock_limit_notify_frequency
integer li_Stock_limit
string ls_Quantity
integer li_Archived
string ls_Page
string ls_Pages
string ls_Limit
string ls_Total
integer i
integer li_Count_i

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_QueryParams = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject")

loo_QueryParams.UpdateString("limit","<integer>")
loo_QueryParams.UpdateString("page","<integer>")
loo_QueryParams.UpdateString("type","PRODUCT")
loo_QueryParams.UpdateString("number","<string>")

loo_Http.SetRequestHeader("Authorization","{{apiKey}}")
loo_Http.SetRequestHeader("Accept","application/json")

loo_Resp = loo_Http.QuickRequestParams("GET","https://api.easybill.de/rest/v1/positions",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_QueryParams
    return
end if

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

loo_Resp.GetBodySb(loo_SbResponseBody)

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Resp.Header
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Http
    destroy loo_QueryParams
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

destroy loo_Resp

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "page": "<integer>",
//   "pages": "<integer>",
//   "limit": "<integer>",
//   "total": "<integer>",
//   "items": [
//     {
//       "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
//     },
//     {
//       "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

ls_Page = loo_JResp.StringOf("page")
ls_Pages = loo_JResp.StringOf("pages")
ls_Limit = loo_JResp.StringOf("limit")
ls_Total = loo_JResp.StringOf("total")
i = 0
li_Count_i = loo_JResp.SizeOfArray("items")
do while i < li_Count_i
    loo_JResp.I = i
    ls_V_number = loo_JResp.StringOf("items[i].number")
    ls_Description = loo_JResp.StringOf("items[i].description")
    ls_Sale_price = loo_JResp.StringOf("items[i].sale_price")
    ls_Id = loo_JResp.StringOf("items[i].id")
    ls_V_type = loo_JResp.StringOf("items[i].type")
    ls_Document_note = loo_JResp.StringOf("items[i].document_note")
    ls_Note = loo_JResp.StringOf("items[i].note")
    ls_Unit = loo_JResp.StringOf("items[i].unit")
    ls_Export_identifier = loo_JResp.StringOf("items[i].export_identifier")
    ls_V_NULL = loo_JResp.StringOf("items[i].export_identifier_extended.NULL")
    ls_NStb = loo_JResp.StringOf("items[i].export_identifier_extended.nStb")
    ls_NStbUstID = loo_JResp.StringOf("items[i].export_identifier_extended.nStbUstID")
    ls_NStbNoneUstID = loo_JResp.StringOf("items[i].export_identifier_extended.nStbNoneUstID")
    ls_NStbIm = loo_JResp.StringOf("items[i].export_identifier_extended.nStbIm")
    ls_Revc = loo_JResp.StringOf("items[i].export_identifier_extended.revc")
    ls_IG = loo_JResp.StringOf("items[i].export_identifier_extended.IG")
    ls_AL = loo_JResp.StringOf("items[i].export_identifier_extended.AL")
    ls_SStfr = loo_JResp.StringOf("items[i].export_identifier_extended.sStfr")
    ls_SmallBusiness = loo_JResp.StringOf("items[i].export_identifier_extended.smallBusiness")
    ls_Login_id = loo_JResp.StringOf("items[i].login_id")
    ls_Price_type = loo_JResp.StringOf("items[i].price_type")
    li_Vat_percent = loo_JResp.IntOf("items[i].vat_percent")
    ls_Sale_price2 = loo_JResp.StringOf("items[i].sale_price2")
    ls_Sale_price3 = loo_JResp.StringOf("items[i].sale_price3")
    ls_Sale_price4 = loo_JResp.StringOf("items[i].sale_price4")
    ls_Sale_price5 = loo_JResp.StringOf("items[i].sale_price5")
    ls_Sale_price6 = loo_JResp.StringOf("items[i].sale_price6")
    ls_Sale_price7 = loo_JResp.StringOf("items[i].sale_price7")
    ls_Sale_price8 = loo_JResp.StringOf("items[i].sale_price8")
    ls_Sale_price9 = loo_JResp.StringOf("items[i].sale_price9")
    ls_Sale_price10 = loo_JResp.StringOf("items[i].sale_price10")
    ls_Cost_price = loo_JResp.StringOf("items[i].cost_price")
    ls_Export_cost1 = loo_JResp.StringOf("items[i].export_cost1")
    ls_Export_cost2 = loo_JResp.StringOf("items[i].export_cost2")
    ls_Group_id = loo_JResp.StringOf("items[i].group_id")
    ls_Stock = loo_JResp.StringOf("items[i].stock")
    li_Stock_count = loo_JResp.IntOf("items[i].stock_count")
    li_Stock_limit_notify = loo_JResp.BoolOf("items[i].stock_limit_notify")
    ls_Stock_limit_notify_frequency = loo_JResp.StringOf("items[i].stock_limit_notify_frequency")
    li_Stock_limit = loo_JResp.IntOf("items[i].stock_limit")
    ls_Quantity = loo_JResp.StringOf("items[i].quantity")
    li_Archived = loo_JResp.BoolOf("items[i].archived")
    i = i + 1
loop


destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl -G -d "limit=%3Cinteger%3E"
	-d "page=%3Cinteger%3E"
	-d "type=PRODUCT"
	-d "number=%3Cstring%3E"
	-H "Authorization: {{apiKey}}"
	-H "Accept: application/json"
https://api.easybill.de/rest/v1/positions

Postman Collection Item JSON

{
  "name": "Fetch positions list",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/positions?limit=<integer>&page=<integer>&type=PRODUCT&number=<string>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "positions"
      ],
      "query": [
        {
          "key": "limit",
          "value": "<integer>",
          "description": "Limited the result. Default is 100. Maximum can be 1000."
        },
        {
          "key": "page",
          "value": "<integer>",
          "description": "Set current Page. Default is 1."
        },
        {
          "key": "type",
          "value": "PRODUCT",
          "description": "Filter positions by type."
        },
        {
          "key": "number",
          "value": "<string>",
          "description": "Filter positions by number. You can add multiple numbers separate by comma like no,no,no."
        }
      ]
    }
  },
  "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?limit=<integer>&page=<integer>&type=PRODUCT&number=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "positions"
          ],
          "query": [
            {
              "key": "limit",
              "value": "<integer>",
              "description": "Limited the result. Default is 100. Maximum can be 1000."
            },
            {
              "key": "page",
              "value": "<integer>",
              "description": "Set current Page. Default is 1."
            },
            {
              "key": "type",
              "value": "PRODUCT",
              "description": "Filter positions by type."
            },
            {
              "key": "number",
              "value": "<string>",
              "description": "Filter positions by number. You can add multiple numbers separate by comma like no,no,no."
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"page\": \"<integer>\",\n  \"pages\": \"<integer>\",\n  \"limit\": \"<integer>\",\n  \"total\": \"<integer>\",\n  \"items\": [\n    {\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    },\n    {\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    }\n  ]\n}"
    },
    {
      "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?limit=<integer>&page=<integer>&type=PRODUCT&number=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "positions"
          ],
          "query": [
            {
              "key": "limit",
              "value": "<integer>",
              "description": "Limited the result. Default is 100. Maximum can be 1000."
            },
            {
              "key": "page",
              "value": "<integer>",
              "description": "Set current Page. Default is 1."
            },
            {
              "key": "type",
              "value": "PRODUCT",
              "description": "Filter positions by type."
            },
            {
              "key": "number",
              "value": "<string>",
              "description": "Filter positions by number. You can add multiple numbers separate by comma like no,no,no."
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}