Chilkat Online Tools

Foxpro / easybill REST API / Fetch position

Back to Collection Items

LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcV_number
LOCAL lcDescription
LOCAL lcSale_price
LOCAL lcId
LOCAL lcV_type
LOCAL lcDocument_note
LOCAL lcNote
LOCAL lcUnit
LOCAL lcExport_identifier
LOCAL lcV_NULL
LOCAL lcNStb
LOCAL lcNStbUstID
LOCAL lcNStbNoneUstID
LOCAL lcNStbIm
LOCAL lcRevc
LOCAL lcIG
LOCAL lcAL
LOCAL lcSStfr
LOCAL lcSmallBusiness
LOCAL lcLogin_id
LOCAL lcPrice_type
LOCAL lnVat_percent
LOCAL lcSale_price2
LOCAL lcSale_price3
LOCAL lcSale_price4
LOCAL lcSale_price5
LOCAL lcSale_price6
LOCAL lcSale_price7
LOCAL lcSale_price8
LOCAL lcSale_price9
LOCAL lcSale_price10
LOCAL lcCost_price
LOCAL lcExport_cost1
LOCAL lcExport_cost2
LOCAL lcGroup_id
LOCAL lcStock
LOCAL lnStock_count
LOCAL lnStock_limit_notify
LOCAL lcStock_limit_notify_frequency
LOCAL lnStock_limit
LOCAL lcQuantity
LOCAL lnArchived

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://api.easybill.de/rest/v1/positions/:id",loSbResponseBody)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loSbResponseBody
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "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
    CANCEL
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")
lnStock_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")
lnArchived = 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": ""
    }
  ]
}