Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Authorization', '{{apiKey}}'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Accept', 'application/json'
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://api.easybill.de/rest/v1/customers/:id', @sbResponseBody
IF @success = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
RETURN
END
DECLARE @jResp int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @http, 'LastStatus', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
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
DECLARE @strVal nvarchar(4000)
DECLARE @last_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @last_name OUT, 'last_name'
DECLARE @company_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @company_name OUT, 'company_name'
DECLARE @acquire_options int
EXEC sp_OAMethod @jResp, 'IntOf', @acquire_options OUT, 'acquire_options'
DECLARE @bank_account nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @bank_account OUT, 'bank_account'
DECLARE @bank_account_owner nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @bank_account_owner OUT, 'bank_account_owner'
DECLARE @bank_bic nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @bank_bic OUT, 'bank_bic'
DECLARE @bank_code nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @bank_code OUT, 'bank_code'
DECLARE @bank_iban nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @bank_iban OUT, 'bank_iban'
DECLARE @bank_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @bank_name OUT, 'bank_name'
DECLARE @birth_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @birth_date OUT, 'birth_date'
DECLARE @cash_allowance nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @cash_allowance OUT, 'cash_allowance'
DECLARE @cash_allowance_days int
EXEC sp_OAMethod @jResp, 'IntOf', @cash_allowance_days OUT, 'cash_allowance_days'
DECLARE @cash_discount nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @cash_discount OUT, 'cash_discount'
DECLARE @cash_discount_type nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @cash_discount_type OUT, 'cash_discount_type'
DECLARE @city nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @city OUT, 'city'
DECLARE @state nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @state OUT, 'state'
DECLARE @country nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @country OUT, 'country'
DECLARE @created_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @created_at OUT, 'created_at'
DECLARE @updated_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @updated_at OUT, 'updated_at'
DECLARE @delivery_title nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_title OUT, 'delivery_title'
DECLARE @delivery_city nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_city OUT, 'delivery_city'
DECLARE @delivery_state nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_state OUT, 'delivery_state'
DECLARE @delivery_company_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_company_name OUT, 'delivery_company_name'
DECLARE @delivery_country nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_country OUT, 'delivery_country'
DECLARE @delivery_first_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_first_name OUT, 'delivery_first_name'
DECLARE @delivery_last_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_last_name OUT, 'delivery_last_name'
DECLARE @delivery_personal nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_personal OUT, 'delivery_personal'
DECLARE @delivery_salutation int
EXEC sp_OAMethod @jResp, 'IntOf', @delivery_salutation OUT, 'delivery_salutation'
DECLARE @delivery_street nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_street OUT, 'delivery_street'
DECLARE @delivery_suffix_1 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_suffix_1 OUT, 'delivery_suffix_1'
DECLARE @delivery_suffix_2 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_suffix_2 OUT, 'delivery_suffix_2'
DECLARE @delivery_zip_code nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @delivery_zip_code OUT, 'delivery_zip_code'
DECLARE @display_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @display_name OUT, 'display_name'
DECLARE @fax nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @fax OUT, 'fax'
DECLARE @first_name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @first_name OUT, 'first_name'
DECLARE @grace_period nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @grace_period OUT, 'grace_period'
DECLARE @due_in_days nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @due_in_days OUT, 'due_in_days'
DECLARE @group_id nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @group_id OUT, 'group_id'
DECLARE @id nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'id'
DECLARE @info_1 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @info_1 OUT, 'info_1'
DECLARE @info_2 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @info_2 OUT, 'info_2'
DECLARE @internet nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @internet OUT, 'internet'
DECLARE @login_id nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @login_id OUT, 'login_id'
DECLARE @mobile nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @mobile OUT, 'mobile'
DECLARE @note nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @note OUT, 'note'
DECLARE @v_number nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @v_number OUT, 'number'
DECLARE @payment_options int
EXEC sp_OAMethod @jResp, 'IntOf', @payment_options OUT, 'payment_options'
DECLARE @personal int
EXEC sp_OAMethod @jResp, 'BoolOf', @personal OUT, 'personal'
DECLARE @phone_1 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @phone_1 OUT, 'phone_1'
DECLARE @phone_2 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @phone_2 OUT, 'phone_2'
DECLARE @postbox nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @postbox OUT, 'postbox'
DECLARE @postbox_city nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @postbox_city OUT, 'postbox_city'
DECLARE @postbox_state nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @postbox_state OUT, 'postbox_state'
DECLARE @postbox_country nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @postbox_country OUT, 'postbox_country'
DECLARE @postbox_zip_code nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @postbox_zip_code OUT, 'postbox_zip_code'
DECLARE @sale_price_level nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @sale_price_level OUT, 'sale_price_level'
DECLARE @salutation int
EXEC sp_OAMethod @jResp, 'IntOf', @salutation OUT, 'salutation'
DECLARE @sepa_agreement nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @sepa_agreement OUT, 'sepa_agreement'
DECLARE @sepa_agreement_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @sepa_agreement_date OUT, 'sepa_agreement_date'
DECLARE @sepa_mandate_reference nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @sepa_mandate_reference OUT, 'sepa_mandate_reference'
DECLARE @since_date nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @since_date OUT, 'since_date'
DECLARE @street nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @street OUT, 'street'
DECLARE @suffix_1 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @suffix_1 OUT, 'suffix_1'
DECLARE @suffix_2 nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @suffix_2 OUT, 'suffix_2'
DECLARE @tax_number nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @tax_number OUT, 'tax_number'
DECLARE @court nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @court OUT, 'court'
DECLARE @court_registry_number nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @court_registry_number OUT, 'court_registry_number'
DECLARE @tax_options nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @tax_options OUT, 'tax_options'
DECLARE @title nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @title OUT, 'title'
DECLARE @archived nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @archived OUT, 'archived'
DECLARE @vat_identifier nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @vat_identifier OUT, 'vat_identifier'
DECLARE @zip_code nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @zip_code OUT, 'zip_code'
DECLARE @document_pdf_type nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @document_pdf_type OUT, 'document_pdf_type'
DECLARE @buyer_reference nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @buyer_reference OUT, 'buyer_reference'
DECLARE @foreign_supplier_number nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @foreign_supplier_number OUT, 'foreign_supplier_number'
DECLARE @i int
SELECT @i = 0
DECLARE @count_i int
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'additional_groups_ids'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'additional_groups_ids[i]'
SELECT @i = @i + 1
END
SELECT @i = 0
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'emails'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'emails[i]'
SELECT @i = @i + 1
END
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
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": ""
}
]
}