Chilkat Online Tools

DataFlex / easybill REST API / Fetch customer

Back to Collection Items

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sStrVal
    String sLast_name
    String sCompany_name
    Integer iAcquire_options
    String sBank_account
    String sBank_account_owner
    String sBank_bic
    String sBank_code
    String sBank_iban
    String sBank_name
    String sBirth_date
    String sCash_allowance
    Integer iCash_allowance_days
    String sCash_discount
    String sCash_discount_type
    String sCity
    String sState
    String sCountry
    String sCreated_at
    String sUpdated_at
    String sDelivery_title
    String sDelivery_city
    String sDelivery_state
    String sDelivery_company_name
    String sDelivery_country
    String sDelivery_first_name
    String sDelivery_last_name
    String sDelivery_personal
    Integer iDelivery_salutation
    String sDelivery_street
    String sDelivery_suffix_1
    String sDelivery_suffix_2
    String sDelivery_zip_code
    String sDisplay_name
    String sFax
    String sFirst_name
    String sGrace_period
    String sDue_in_days
    String sGroup_id
    String sId
    String sInfo_1
    String sInfo_2
    String sInternet
    String sLogin_id
    String sMobile
    String sNote
    String sV_number
    Integer iPayment_options
    Boolean iPersonal
    String sPhone_1
    String sPhone_2
    String sPostbox
    String sPostbox_city
    String sPostbox_state
    String sPostbox_country
    String sPostbox_zip_code
    String sSale_price_level
    Integer iSalutation
    String sSepa_agreement
    String sSepa_agreement_date
    String sSepa_mandate_reference
    String sSince_date
    String sStreet
    String sSuffix_1
    String sSuffix_2
    String sTax_number
    String sCourt
    String sCourt_registry_number
    String sTax_options
    String sTitle
    String sArchived
    String sVat_identifier
    String sZip_code
    String sDocument_pdf_type
    String sBuyer_reference
    String sForeign_supplier_number
    Integer i
    Integer iCount_i
    String sTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Send ComSetRequestHeader To hoHttp "Authorization" "{{apiKey}}"
    Send ComSetRequestHeader To hoHttp "Accept" "application/json"

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://api.easybill.de/rest/v1/customers/:id" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

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

    Get ComStringOf Of hoJResp "last_name" To sLast_name
    Get ComStringOf Of hoJResp "company_name" To sCompany_name
    Get ComIntOf Of hoJResp "acquire_options" To iAcquire_options
    Get ComStringOf Of hoJResp "bank_account" To sBank_account
    Get ComStringOf Of hoJResp "bank_account_owner" To sBank_account_owner
    Get ComStringOf Of hoJResp "bank_bic" To sBank_bic
    Get ComStringOf Of hoJResp "bank_code" To sBank_code
    Get ComStringOf Of hoJResp "bank_iban" To sBank_iban
    Get ComStringOf Of hoJResp "bank_name" To sBank_name
    Get ComStringOf Of hoJResp "birth_date" To sBirth_date
    Get ComStringOf Of hoJResp "cash_allowance" To sCash_allowance
    Get ComIntOf Of hoJResp "cash_allowance_days" To iCash_allowance_days
    Get ComStringOf Of hoJResp "cash_discount" To sCash_discount
    Get ComStringOf Of hoJResp "cash_discount_type" To sCash_discount_type
    Get ComStringOf Of hoJResp "city" To sCity
    Get ComStringOf Of hoJResp "state" To sState
    Get ComStringOf Of hoJResp "country" To sCountry
    Get ComStringOf Of hoJResp "created_at" To sCreated_at
    Get ComStringOf Of hoJResp "updated_at" To sUpdated_at
    Get ComStringOf Of hoJResp "delivery_title" To sDelivery_title
    Get ComStringOf Of hoJResp "delivery_city" To sDelivery_city
    Get ComStringOf Of hoJResp "delivery_state" To sDelivery_state
    Get ComStringOf Of hoJResp "delivery_company_name" To sDelivery_company_name
    Get ComStringOf Of hoJResp "delivery_country" To sDelivery_country
    Get ComStringOf Of hoJResp "delivery_first_name" To sDelivery_first_name
    Get ComStringOf Of hoJResp "delivery_last_name" To sDelivery_last_name
    Get ComStringOf Of hoJResp "delivery_personal" To sDelivery_personal
    Get ComIntOf Of hoJResp "delivery_salutation" To iDelivery_salutation
    Get ComStringOf Of hoJResp "delivery_street" To sDelivery_street
    Get ComStringOf Of hoJResp "delivery_suffix_1" To sDelivery_suffix_1
    Get ComStringOf Of hoJResp "delivery_suffix_2" To sDelivery_suffix_2
    Get ComStringOf Of hoJResp "delivery_zip_code" To sDelivery_zip_code
    Get ComStringOf Of hoJResp "display_name" To sDisplay_name
    Get ComStringOf Of hoJResp "fax" To sFax
    Get ComStringOf Of hoJResp "first_name" To sFirst_name
    Get ComStringOf Of hoJResp "grace_period" To sGrace_period
    Get ComStringOf Of hoJResp "due_in_days" To sDue_in_days
    Get ComStringOf Of hoJResp "group_id" To sGroup_id
    Get ComStringOf Of hoJResp "id" To sId
    Get ComStringOf Of hoJResp "info_1" To sInfo_1
    Get ComStringOf Of hoJResp "info_2" To sInfo_2
    Get ComStringOf Of hoJResp "internet" To sInternet
    Get ComStringOf Of hoJResp "login_id" To sLogin_id
    Get ComStringOf Of hoJResp "mobile" To sMobile
    Get ComStringOf Of hoJResp "note" To sNote
    Get ComStringOf Of hoJResp "number" To sV_number
    Get ComIntOf Of hoJResp "payment_options" To iPayment_options
    Get ComBoolOf Of hoJResp "personal" To iPersonal
    Get ComStringOf Of hoJResp "phone_1" To sPhone_1
    Get ComStringOf Of hoJResp "phone_2" To sPhone_2
    Get ComStringOf Of hoJResp "postbox" To sPostbox
    Get ComStringOf Of hoJResp "postbox_city" To sPostbox_city
    Get ComStringOf Of hoJResp "postbox_state" To sPostbox_state
    Get ComStringOf Of hoJResp "postbox_country" To sPostbox_country
    Get ComStringOf Of hoJResp "postbox_zip_code" To sPostbox_zip_code
    Get ComStringOf Of hoJResp "sale_price_level" To sSale_price_level
    Get ComIntOf Of hoJResp "salutation" To iSalutation
    Get ComStringOf Of hoJResp "sepa_agreement" To sSepa_agreement
    Get ComStringOf Of hoJResp "sepa_agreement_date" To sSepa_agreement_date
    Get ComStringOf Of hoJResp "sepa_mandate_reference" To sSepa_mandate_reference
    Get ComStringOf Of hoJResp "since_date" To sSince_date
    Get ComStringOf Of hoJResp "street" To sStreet
    Get ComStringOf Of hoJResp "suffix_1" To sSuffix_1
    Get ComStringOf Of hoJResp "suffix_2" To sSuffix_2
    Get ComStringOf Of hoJResp "tax_number" To sTax_number
    Get ComStringOf Of hoJResp "court" To sCourt
    Get ComStringOf Of hoJResp "court_registry_number" To sCourt_registry_number
    Get ComStringOf Of hoJResp "tax_options" To sTax_options
    Get ComStringOf Of hoJResp "title" To sTitle
    Get ComStringOf Of hoJResp "archived" To sArchived
    Get ComStringOf Of hoJResp "vat_identifier" To sVat_identifier
    Get ComStringOf Of hoJResp "zip_code" To sZip_code
    Get ComStringOf Of hoJResp "document_pdf_type" To sDocument_pdf_type
    Get ComStringOf Of hoJResp "buyer_reference" To sBuyer_reference
    Get ComStringOf Of hoJResp "foreign_supplier_number" To sForeign_supplier_number
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "additional_groups_ids" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "additional_groups_ids[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "emails" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "emails[i]" To sStrVal
        Move (i + 1) To i
    Loop



End_Procedure

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