Chilkat Online Tools

Foxpro / easybill REST API / Fetch customer

Back to Collection Items

LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcStrVal
LOCAL lcLast_name
LOCAL lcCompany_name
LOCAL lnAcquire_options
LOCAL lcBank_account
LOCAL lcBank_account_owner
LOCAL lcBank_bic
LOCAL lcBank_code
LOCAL lcBank_iban
LOCAL lcBank_name
LOCAL lcBirth_date
LOCAL lcCash_allowance
LOCAL lnCash_allowance_days
LOCAL lcCash_discount
LOCAL lcCash_discount_type
LOCAL lcCity
LOCAL lcState
LOCAL lcCountry
LOCAL lcCreated_at
LOCAL lcUpdated_at
LOCAL lcDelivery_title
LOCAL lcDelivery_city
LOCAL lcDelivery_state
LOCAL lcDelivery_company_name
LOCAL lcDelivery_country
LOCAL lcDelivery_first_name
LOCAL lcDelivery_last_name
LOCAL lcDelivery_personal
LOCAL lnDelivery_salutation
LOCAL lcDelivery_street
LOCAL lcDelivery_suffix_1
LOCAL lcDelivery_suffix_2
LOCAL lcDelivery_zip_code
LOCAL lcDisplay_name
LOCAL lcFax
LOCAL lcFirst_name
LOCAL lcGrace_period
LOCAL lcDue_in_days
LOCAL lcGroup_id
LOCAL lcId
LOCAL lcInfo_1
LOCAL lcInfo_2
LOCAL lcInternet
LOCAL lcLogin_id
LOCAL lcMobile
LOCAL lcNote
LOCAL lcV_number
LOCAL lnPayment_options
LOCAL lnPersonal
LOCAL lcPhone_1
LOCAL lcPhone_2
LOCAL lcPostbox
LOCAL lcPostbox_city
LOCAL lcPostbox_state
LOCAL lcPostbox_country
LOCAL lcPostbox_zip_code
LOCAL lcSale_price_level
LOCAL lnSalutation
LOCAL lcSepa_agreement
LOCAL lcSepa_agreement_date
LOCAL lcSepa_mandate_reference
LOCAL lcSince_date
LOCAL lcStreet
LOCAL lcSuffix_1
LOCAL lcSuffix_2
LOCAL lcTax_number
LOCAL lcCourt
LOCAL lcCourt_registry_number
LOCAL lcTax_options
LOCAL lcTitle
LOCAL lcArchived
LOCAL lcVat_identifier
LOCAL lcZip_code
LOCAL lcDocument_pdf_type
LOCAL lcBuyer_reference
LOCAL lcForeign_supplier_number
LOCAL i
LOCAL lnCount_i

* 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/customers/: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)

* {
*   "last_name": "<string>",
*   "company_name": "<string>",
*   "acquire_options": 2,
*   "additional_groups_ids": [
*     "<integer>",
*     "<integer>"
*   ],
*   "bank_account": "<string>",
*   "bank_account_owner": "<string>",
*   "bank_bic": "<string>",
*   "bank_code": "<string>",
*   "bank_iban": "<string>",
*   "bank_name": "<string>",
*   "birth_date": "<date>",
*   "cash_allowance": "<float>",
*   "cash_allowance_days": 7,
*   "cash_discount": "<float>",
*   "cash_discount_type": "AMOUNT",
*   "city": "<string>",
*   "state": "<string>",
*   "country": "<string>",
*   "created_at": "<date>",
*   "updated_at": "<string>",
*   "delivery_title": "<string>",
*   "delivery_city": "<string>",
*   "delivery_state": "<string>",
*   "delivery_company_name": "<string>",
*   "delivery_country": "<string>",
*   "delivery_first_name": "<string>",
*   "delivery_last_name": "<string>",
*   "delivery_personal": "<boolean>",
*   "delivery_salutation": 0,
*   "delivery_street": "<string>",
*   "delivery_suffix_1": "<string>",
*   "delivery_suffix_2": "<string>",
*   "delivery_zip_code": "<string>",
*   "display_name": "<string>",
*   "emails": [
*     "<string>",
*     "<string>"
*   ],
*   "fax": "<string>",
*   "first_name": "<string>",
*   "grace_period": "<integer>",
*   "due_in_days": "<integer>",
*   "group_id": "<integer>",
*   "id": "<long>",
*   "info_1": "<string>",
*   "info_2": "<string>",
*   "internet": "<string>",
*   "login_id": "<long>",
*   "mobile": "<string>",
*   "note": "<string>",
*   "number": "<string>",
*   "payment_options": 5,
*   "personal": false,
*   "phone_1": "<string>",
*   "phone_2": "<string>",
*   "postbox": "<string>",
*   "postbox_city": "<string>",
*   "postbox_state": "<string>",
*   "postbox_country": "<string>",
*   "postbox_zip_code": "<string>",
*   "sale_price_level": "SALEPRICE10",
*   "salutation": 0,
*   "sepa_agreement": "BASIC",
*   "sepa_agreement_date": "<date>",
*   "sepa_mandate_reference": "<string>",
*   "since_date": "<date>",
*   "street": "<string>",
*   "suffix_1": "<string>",
*   "suffix_2": "<string>",
*   "tax_number": "<string>",
*   "court": "<string>",
*   "court_registry_number": "<string>",
*   "tax_options": "nStbUstID",
*   "title": "<string>",
*   "archived": "<boolean>",
*   "vat_identifier": "<string>",
*   "zip_code": "<string>",
*   "document_pdf_type": "default",
*   "buyer_reference": "<string>",
*   "foreign_supplier_number": "<string>"
* }

* Sample code for parsing the JSON response...
* Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

lcLast_name = loJResp.StringOf("last_name")
lcCompany_name = loJResp.StringOf("company_name")
lnAcquire_options = loJResp.IntOf("acquire_options")
lcBank_account = loJResp.StringOf("bank_account")
lcBank_account_owner = loJResp.StringOf("bank_account_owner")
lcBank_bic = loJResp.StringOf("bank_bic")
lcBank_code = loJResp.StringOf("bank_code")
lcBank_iban = loJResp.StringOf("bank_iban")
lcBank_name = loJResp.StringOf("bank_name")
lcBirth_date = loJResp.StringOf("birth_date")
lcCash_allowance = loJResp.StringOf("cash_allowance")
lnCash_allowance_days = loJResp.IntOf("cash_allowance_days")
lcCash_discount = loJResp.StringOf("cash_discount")
lcCash_discount_type = loJResp.StringOf("cash_discount_type")
lcCity = loJResp.StringOf("city")
lcState = loJResp.StringOf("state")
lcCountry = loJResp.StringOf("country")
lcCreated_at = loJResp.StringOf("created_at")
lcUpdated_at = loJResp.StringOf("updated_at")
lcDelivery_title = loJResp.StringOf("delivery_title")
lcDelivery_city = loJResp.StringOf("delivery_city")
lcDelivery_state = loJResp.StringOf("delivery_state")
lcDelivery_company_name = loJResp.StringOf("delivery_company_name")
lcDelivery_country = loJResp.StringOf("delivery_country")
lcDelivery_first_name = loJResp.StringOf("delivery_first_name")
lcDelivery_last_name = loJResp.StringOf("delivery_last_name")
lcDelivery_personal = loJResp.StringOf("delivery_personal")
lnDelivery_salutation = loJResp.IntOf("delivery_salutation")
lcDelivery_street = loJResp.StringOf("delivery_street")
lcDelivery_suffix_1 = loJResp.StringOf("delivery_suffix_1")
lcDelivery_suffix_2 = loJResp.StringOf("delivery_suffix_2")
lcDelivery_zip_code = loJResp.StringOf("delivery_zip_code")
lcDisplay_name = loJResp.StringOf("display_name")
lcFax = loJResp.StringOf("fax")
lcFirst_name = loJResp.StringOf("first_name")
lcGrace_period = loJResp.StringOf("grace_period")
lcDue_in_days = loJResp.StringOf("due_in_days")
lcGroup_id = loJResp.StringOf("group_id")
lcId = loJResp.StringOf("id")
lcInfo_1 = loJResp.StringOf("info_1")
lcInfo_2 = loJResp.StringOf("info_2")
lcInternet = loJResp.StringOf("internet")
lcLogin_id = loJResp.StringOf("login_id")
lcMobile = loJResp.StringOf("mobile")
lcNote = loJResp.StringOf("note")
lcV_number = loJResp.StringOf("number")
lnPayment_options = loJResp.IntOf("payment_options")
lnPersonal = loJResp.BoolOf("personal")
lcPhone_1 = loJResp.StringOf("phone_1")
lcPhone_2 = loJResp.StringOf("phone_2")
lcPostbox = loJResp.StringOf("postbox")
lcPostbox_city = loJResp.StringOf("postbox_city")
lcPostbox_state = loJResp.StringOf("postbox_state")
lcPostbox_country = loJResp.StringOf("postbox_country")
lcPostbox_zip_code = loJResp.StringOf("postbox_zip_code")
lcSale_price_level = loJResp.StringOf("sale_price_level")
lnSalutation = loJResp.IntOf("salutation")
lcSepa_agreement = loJResp.StringOf("sepa_agreement")
lcSepa_agreement_date = loJResp.StringOf("sepa_agreement_date")
lcSepa_mandate_reference = loJResp.StringOf("sepa_mandate_reference")
lcSince_date = loJResp.StringOf("since_date")
lcStreet = loJResp.StringOf("street")
lcSuffix_1 = loJResp.StringOf("suffix_1")
lcSuffix_2 = loJResp.StringOf("suffix_2")
lcTax_number = loJResp.StringOf("tax_number")
lcCourt = loJResp.StringOf("court")
lcCourt_registry_number = loJResp.StringOf("court_registry_number")
lcTax_options = loJResp.StringOf("tax_options")
lcTitle = loJResp.StringOf("title")
lcArchived = loJResp.StringOf("archived")
lcVat_identifier = loJResp.StringOf("vat_identifier")
lcZip_code = loJResp.StringOf("zip_code")
lcDocument_pdf_type = loJResp.StringOf("document_pdf_type")
lcBuyer_reference = loJResp.StringOf("buyer_reference")
lcForeign_supplier_number = loJResp.StringOf("foreign_supplier_number")
i = 0
lnCount_i = loJResp.SizeOfArray("additional_groups_ids")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcStrVal = loJResp.StringOf("additional_groups_ids[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("emails")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcStrVal = loJResp.StringOf("emails[i]")
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp

Curl Command

curl -X GET
	-H "Authorization: {{apiKey}}"
	-H "Accept: application/json"
https://api.easybill.de/rest/v1/customers/:id

Postman Collection Item JSON

{
  "name": "Fetch customer",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/customers/:id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "customers",
        ":id"
      ],
      "variable": [
        {
          "key": "id",
          "value": "<long>",
          "description": "(Required) ID of customer that needs to be fetched"
        }
      ]
    }
  },
  "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}}/customers/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "customers",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"last_name\": \"<string>\",\n  \"company_name\": \"<string>\",\n  \"acquire_options\": 2,\n  \"additional_groups_ids\": [\n    \"<integer>\",\n    \"<integer>\"\n  ],\n  \"bank_account\": \"<string>\",\n  \"bank_account_owner\": \"<string>\",\n  \"bank_bic\": \"<string>\",\n  \"bank_code\": \"<string>\",\n  \"bank_iban\": \"<string>\",\n  \"bank_name\": \"<string>\",\n  \"birth_date\": \"<date>\",\n  \"cash_allowance\": \"<float>\",\n  \"cash_allowance_days\": 7,\n  \"cash_discount\": \"<float>\",\n  \"cash_discount_type\": \"AMOUNT\",\n  \"city\": \"<string>\",\n  \"state\": \"<string>\",\n  \"country\": \"<string>\",\n  \"created_at\": \"<date>\",\n  \"updated_at\": \"<string>\",\n  \"delivery_title\": \"<string>\",\n  \"delivery_city\": \"<string>\",\n  \"delivery_state\": \"<string>\",\n  \"delivery_company_name\": \"<string>\",\n  \"delivery_country\": \"<string>\",\n  \"delivery_first_name\": \"<string>\",\n  \"delivery_last_name\": \"<string>\",\n  \"delivery_personal\": \"<boolean>\",\n  \"delivery_salutation\": 0,\n  \"delivery_street\": \"<string>\",\n  \"delivery_suffix_1\": \"<string>\",\n  \"delivery_suffix_2\": \"<string>\",\n  \"delivery_zip_code\": \"<string>\",\n  \"display_name\": \"<string>\",\n  \"emails\": [\n    \"<string>\",\n    \"<string>\"\n  ],\n  \"fax\": \"<string>\",\n  \"first_name\": \"<string>\",\n  \"grace_period\": \"<integer>\",\n  \"due_in_days\": \"<integer>\",\n  \"group_id\": \"<integer>\",\n  \"id\": \"<long>\",\n  \"info_1\": \"<string>\",\n  \"info_2\": \"<string>\",\n  \"internet\": \"<string>\",\n  \"login_id\": \"<long>\",\n  \"mobile\": \"<string>\",\n  \"note\": \"<string>\",\n  \"number\": \"<string>\",\n  \"payment_options\": 5,\n  \"personal\": false,\n  \"phone_1\": \"<string>\",\n  \"phone_2\": \"<string>\",\n  \"postbox\": \"<string>\",\n  \"postbox_city\": \"<string>\",\n  \"postbox_state\": \"<string>\",\n  \"postbox_country\": \"<string>\",\n  \"postbox_zip_code\": \"<string>\",\n  \"sale_price_level\": \"SALEPRICE10\",\n  \"salutation\": 0,\n  \"sepa_agreement\": \"BASIC\",\n  \"sepa_agreement_date\": \"<date>\",\n  \"sepa_mandate_reference\": \"<string>\",\n  \"since_date\": \"<date>\",\n  \"street\": \"<string>\",\n  \"suffix_1\": \"<string>\",\n  \"suffix_2\": \"<string>\",\n  \"tax_number\": \"<string>\",\n  \"court\": \"<string>\",\n  \"court_registry_number\": \"<string>\",\n  \"tax_options\": \"nStbUstID\",\n  \"title\": \"<string>\",\n  \"archived\": \"<boolean>\",\n  \"vat_identifier\": \"<string>\",\n  \"zip_code\": \"<string>\",\n  \"document_pdf_type\": \"default\",\n  \"buyer_reference\": \"<string>\",\n  \"foreign_supplier_number\": \"<string>\"\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}}/customers/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "customers",
            ":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}}/customers/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "customers",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}