Chilkat Online Tools

PowerBuilder / easybill REST API / Fetch position

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
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

// 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_Http.SetRequestHeader("Authorization","{{apiKey}}")
loo_Http.SetRequestHeader("Accept","application/json")

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

li_Success = loo_Http.QuickGetSb("https://api.easybill.de/rest/v1/positions/:id",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

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_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

// 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

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


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

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": ""
    }
  ]
}