Chilkat Online Tools

SQL Server / easybill REST API / To complete a document.

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
    DECLARE @iTmp0 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
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.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 @resp int
    EXEC sp_OAMethod @http, 'QuickRequest', @resp OUT, 'PUT', 'https://api.easybill.de/rest/v1/documents/:id/done?reason_for_change=<string>'
    EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        RETURN
      END

    DECLARE @sbResponseBody int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody

    DECLARE @jResp int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.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 @resp, 'StatusCode', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode
    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @resp

        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        RETURN
      END
    EXEC @hr = sp_OADestroy @resp

    -- Sample JSON response:
    -- (Sample code for parsing the JSON response is shown below)

    -- {
    --   "address": {
    --     "salutation": "<integer>",
    --     "personal": "<boolean>",
    --     "title": "<string>",
    --     "first_name": "<string>",
    --     "last_name": "<string>",
    --     "suffix_1": "<string>",
    --     "suffix_2": "<string>",
    --     "company_name": "<string>",
    --     "street": "<string>",
    --     "zip_code": "<string>",
    --     "city": "<string>",
    --     "state": "<string>",
    --     "country": "<string>"
    --   },
    --   "attachment_ids": [
    --     "<integer>",
    --     "<integer>"
    --   ],
    --   "label_address": {
    --     "salutation": "<integer>",
    --     "personal": "<boolean>",
    --     "title": "<string>",
    --     "first_name": "<string>",
    --     "last_name": "<string>",
    --     "suffix_1": "<string>",
    --     "suffix_2": "<string>",
    --     "company_name": "<string>",
    --     "street": "<string>",
    --     "zip_code": "<string>",
    --     "city": "<string>",
    --     "state": "<string>",
    --     "country": "<string>"
    --   },
    --   "amount": "<integer>",
    --   "amount_net": "<integer>",
    --   "bank_debit_form": null,
    --   "billing_country": "<string>",
    --   "calc_vat_from": 0,
    --   "cancel_id": "<long>",
    --   "cash_allowance": null,
    --   "cash_allowance_days": null,
    --   "cash_allowance_text": null,
    --   "contact_id": null,
    --   "contact_label": "",
    --   "contact_text": "",
    --   "created_at": "<dateTime>",
    --   "currency": "EUR",
    --   "customer_id": null,
    --   "customer_snapshot": {
    --     "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": 1,
    --     "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": "SALEPRICE6",
    --     "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": "nStbIm",
    --     "title": "<string>",
    --     "archived": "<boolean>",
    --     "vat_identifier": "<string>",
    --     "zip_code": "<string>",
    --     "document_pdf_type": "default",
    --     "buyer_reference": "<string>",
    --     "foreign_supplier_number": "<string>"
    --   },
    --   "discount": null,
    --   "discount_type": null,
    --   "document_date": "<date>",
    --   "due_date": "<date>",
    --   "edited_at": "<dateTime>",
    --   "external_id": null,
    --   "replica_url": null,
    --   "grace_period": "<integer>",
    --   "due_in_days": "<integer>",
    --   "id": "<long>",
    --   "is_acceptable_on_public_domain": false,
    --   "is_archive": false,
    --   "is_draft": "<boolean>",
    --   "is_replica": false,
    --   "is_oss": false,
    --   "item_notes": [
    --     "<string>",
    --     "<string>"
    --   ],
    --   "items": [
    --     {
    --       "number": null,
    --       "description": null,
    --       "document_note": "<string>",
    --       "quantity": 1,
    --       "quantity_str": "<string>",
    --       "unit": null,
    --       "type": "POSITION",
    --       "position": "<integer>",
    --       "single_price_net": null,
    --       "single_price_gross": "<float>",
    --       "vat_percent": 0,
    --       "discount": null,
    --       "discount_type": null,
    --       "position_id": null,
    --       "total_price_net": "<float>",
    --       "total_price_gross": "<float>",
    --       "total_vat": "<float>",
    --       "serial_number_id": "<string>",
    --       "serial_number": "<string>",
    --       "booking_account": null,
    --       "export_cost_1": null,
    --       "export_cost_2": null,
    --       "cost_price_net": null,
    --       "cost_price_total": "<float>",
    --       "cost_price_charge": "<float>",
    --       "cost_price_charge_type": "PERCENT",
    --       "itemType": "UNDEFINED",
    --       "id": "<long>"
    --     },
    --     {
    --       "number": null,
    --       "description": null,
    --       "document_note": "<string>",
    --       "quantity": 1,
    --       "quantity_str": "<string>",
    --       "unit": null,
    --       "type": "POSITION",
    --       "position": "<integer>",
    --       "single_price_net": null,
    --       "single_price_gross": "<float>",
    --       "vat_percent": 0,
    --       "discount": null,
    --       "discount_type": null,
    --       "position_id": null,
    --       "total_price_net": "<float>",
    --       "total_price_gross": "<float>",
    --       "total_vat": "<float>",
    --       "serial_number_id": "<string>",
    --       "serial_number": "<string>",
    --       "booking_account": null,
    --       "export_cost_1": null,
    --       "export_cost_2": null,
    --       "cost_price_net": null,
    --       "cost_price_total": "<float>",
    --       "cost_price_charge": "<float>",
    --       "cost_price_charge_type": "PERCENT",
    --       "itemType": "UNDEFINED",
    --       "id": "<long>"
    --     }
    --   ],
    --   "last_postbox_id": "<long>",
    --   "login_id": "<long>",
    --   "number": null,
    --   "order_number": "",
    --   "buyer_reference": "",
    --   "paid_amount": "<integer>",
    --   "paid_at": "<date>",
    --   "pdf_pages": "<integer>",
    --   "pdf_template": "<string>",
    --   "project_id": null,
    --   "recurring_options": {
    --     "next_date": "<date>",
    --     "frequency": "MONTHLY",
    --     "frequency_special": null,
    --     "interval": 1,
    --     "end_date_or_count": null,
    --     "status": "WAITING",
    --     "as_draft": false,
    --     "is_notify": false,
    --     "send_as": null,
    --     "is_sign": false,
    --     "is_paid": false,
    --     "paid_date_option": "created_date",
    --     "is_sepa": false,
    --     "sepa_local_instrument": null,
    --     "sepa_sequence_type": null,
    --     "sepa_reference": null,
    --     "sepa_remittance_information": null,
    --     "target_type": "INVOICE"
    --   },
    --   "ref_id": null,
    --   "root_id": null,
    --   "service_date": {
    --     "type": "SERVICE",
    --     "date": "<date>",
    --     "date_from": "<date>",
    --     "date_to": "<date>",
    --     "text": null
    --   },
    --   "shipping_country": null,
    --   "status": null,
    --   "text": "<string>",
    --   "text_prefix": "<string>",
    --   "text_tax": null,
    --   "title": null,
    --   "type": "INVOICE",
    --   "use_shipping_address": false,
    --   "vat_country": null,
    --   "vat_id": "",
    --   "fulfillment_country": null,
    --   "vat_option": null,
    --   "file_format_config": [
    --     {
    --       "type": "xrechnung2_2_xml"
    --     },
    --     {
    --       "type": "xrechnung3_0_xml"
    --     }
    --   ]
    -- }

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

    DECLARE @Date_from int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.DtObj', @Date_from OUT

    DECLARE @Date_to int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.DtObj', @Date_to OUT

    DECLARE @strVal nvarchar(4000)

    DECLARE @description nvarchar(4000)

    DECLARE @document_note nvarchar(4000)

    DECLARE @quantity int

    DECLARE @quantity_str nvarchar(4000)

    DECLARE @unit nvarchar(4000)

    DECLARE @position nvarchar(4000)

    DECLARE @single_price_net nvarchar(4000)

    DECLARE @single_price_gross nvarchar(4000)

    DECLARE @vat_percent int

    DECLARE @position_id nvarchar(4000)

    DECLARE @total_price_net nvarchar(4000)

    DECLARE @total_price_gross nvarchar(4000)

    DECLARE @total_vat nvarchar(4000)

    DECLARE @serial_number_id nvarchar(4000)

    DECLARE @serial_number nvarchar(4000)

    DECLARE @booking_account nvarchar(4000)

    DECLARE @export_cost_1 nvarchar(4000)

    DECLARE @export_cost_2 nvarchar(4000)

    DECLARE @cost_price_net nvarchar(4000)

    DECLARE @cost_price_total nvarchar(4000)

    DECLARE @cost_price_charge nvarchar(4000)

    DECLARE @cost_price_charge_type nvarchar(4000)

    DECLARE @itemType nvarchar(4000)

    DECLARE @Salutation nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Salutation OUT, 'address.salutation'
    DECLARE @Personal nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Personal OUT, 'address.personal'
    DECLARE @Title nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Title OUT, 'address.title'
    DECLARE @First_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @First_name OUT, 'address.first_name'
    DECLARE @Last_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Last_name OUT, 'address.last_name'
    DECLARE @Suffix_1 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Suffix_1 OUT, 'address.suffix_1'
    DECLARE @Suffix_2 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Suffix_2 OUT, 'address.suffix_2'
    DECLARE @Company_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Company_name OUT, 'address.company_name'
    DECLARE @Street nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Street OUT, 'address.street'
    DECLARE @Zip_code nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Zip_code OUT, 'address.zip_code'
    DECLARE @City nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @City OUT, 'address.city'
    DECLARE @State nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @State OUT, 'address.state'
    DECLARE @Country nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Country OUT, 'address.country'
    DECLARE @label_addressSalutation nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressSalutation OUT, 'label_address.salutation'
    DECLARE @label_addressPersonal nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressPersonal OUT, 'label_address.personal'
    DECLARE @label_addressTitle nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressTitle OUT, 'label_address.title'
    DECLARE @label_addressFirst_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressFirst_name OUT, 'label_address.first_name'
    DECLARE @label_addressLast_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressLast_name OUT, 'label_address.last_name'
    DECLARE @label_addressSuffix_1 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressSuffix_1 OUT, 'label_address.suffix_1'
    DECLARE @label_addressSuffix_2 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressSuffix_2 OUT, 'label_address.suffix_2'
    DECLARE @label_addressCompany_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressCompany_name OUT, 'label_address.company_name'
    DECLARE @label_addressStreet nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressStreet OUT, 'label_address.street'
    DECLARE @label_addressZip_code nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressZip_code OUT, 'label_address.zip_code'
    DECLARE @label_addressCity nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressCity OUT, 'label_address.city'
    DECLARE @label_addressState nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressState OUT, 'label_address.state'
    DECLARE @label_addressCountry nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @label_addressCountry OUT, 'label_address.country'
    DECLARE @amount nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @amount OUT, 'amount'
    DECLARE @amount_net nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @amount_net OUT, 'amount_net'
    DECLARE @bank_debit_form nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @bank_debit_form OUT, 'bank_debit_form'
    DECLARE @billing_country nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @billing_country OUT, 'billing_country'
    DECLARE @calc_vat_from int
    EXEC sp_OAMethod @jResp, 'IntOf', @calc_vat_from OUT, 'calc_vat_from'
    DECLARE @cancel_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @cancel_id OUT, 'cancel_id'
    DECLARE @cash_allowance nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @cash_allowance OUT, 'cash_allowance'
    DECLARE @cash_allowance_days nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @cash_allowance_days OUT, 'cash_allowance_days'
    DECLARE @cash_allowance_text nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @cash_allowance_text OUT, 'cash_allowance_text'
    DECLARE @contact_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @contact_id OUT, 'contact_id'
    DECLARE @contact_label nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @contact_label OUT, 'contact_label'
    DECLARE @contact_text nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @contact_text OUT, 'contact_text'
    DECLARE @created_at nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @created_at OUT, 'created_at'
    DECLARE @v_currency nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_currency OUT, 'currency'
    DECLARE @customer_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_id OUT, 'customer_id'
    DECLARE @customer_snapshotLast_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotLast_name OUT, 'customer_snapshot.last_name'
    DECLARE @customer_snapshotCompany_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotCompany_name OUT, 'customer_snapshot.company_name'
    DECLARE @Acquire_options int
    EXEC sp_OAMethod @jResp, 'IntOf', @Acquire_options OUT, 'customer_snapshot.acquire_options'
    DECLARE @Bank_account nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Bank_account OUT, 'customer_snapshot.bank_account'
    DECLARE @Bank_account_owner nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Bank_account_owner OUT, 'customer_snapshot.bank_account_owner'
    DECLARE @Bank_bic nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Bank_bic OUT, 'customer_snapshot.bank_bic'
    DECLARE @Bank_code nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Bank_code OUT, 'customer_snapshot.bank_code'
    DECLARE @Bank_iban nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Bank_iban OUT, 'customer_snapshot.bank_iban'
    DECLARE @Bank_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Bank_name OUT, 'customer_snapshot.bank_name'
    DECLARE @Birth_date nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Birth_date OUT, 'customer_snapshot.birth_date'
    DECLARE @Cash_allowance nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Cash_allowance OUT, 'customer_snapshot.cash_allowance'
    DECLARE @Cash_allowance_days int
    EXEC sp_OAMethod @jResp, 'IntOf', @Cash_allowance_days OUT, 'customer_snapshot.cash_allowance_days'
    DECLARE @Cash_discount nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Cash_discount OUT, 'customer_snapshot.cash_discount'
    DECLARE @Cash_discount_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Cash_discount_type OUT, 'customer_snapshot.cash_discount_type'
    DECLARE @customer_snapshotCity nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotCity OUT, 'customer_snapshot.city'
    DECLARE @customer_snapshotState nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotState OUT, 'customer_snapshot.state'
    DECLARE @customer_snapshotCountry nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotCountry OUT, 'customer_snapshot.country'
    DECLARE @Created_at nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Created_at OUT, 'customer_snapshot.created_at'
    DECLARE @Updated_at nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Updated_at OUT, 'customer_snapshot.updated_at'
    DECLARE @Delivery_title nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_title OUT, 'customer_snapshot.delivery_title'
    DECLARE @Delivery_city nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_city OUT, 'customer_snapshot.delivery_city'
    DECLARE @Delivery_state nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_state OUT, 'customer_snapshot.delivery_state'
    DECLARE @Delivery_company_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_company_name OUT, 'customer_snapshot.delivery_company_name'
    DECLARE @Delivery_country nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_country OUT, 'customer_snapshot.delivery_country'
    DECLARE @Delivery_first_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_first_name OUT, 'customer_snapshot.delivery_first_name'
    DECLARE @Delivery_last_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_last_name OUT, 'customer_snapshot.delivery_last_name'
    DECLARE @Delivery_personal nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_personal OUT, 'customer_snapshot.delivery_personal'
    DECLARE @Delivery_salutation int
    EXEC sp_OAMethod @jResp, 'IntOf', @Delivery_salutation OUT, 'customer_snapshot.delivery_salutation'
    DECLARE @Delivery_street nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_street OUT, 'customer_snapshot.delivery_street'
    DECLARE @Delivery_suffix_1 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_suffix_1 OUT, 'customer_snapshot.delivery_suffix_1'
    DECLARE @Delivery_suffix_2 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_suffix_2 OUT, 'customer_snapshot.delivery_suffix_2'
    DECLARE @Delivery_zip_code nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Delivery_zip_code OUT, 'customer_snapshot.delivery_zip_code'
    DECLARE @Display_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Display_name OUT, 'customer_snapshot.display_name'
    DECLARE @Fax nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Fax OUT, 'customer_snapshot.fax'
    DECLARE @customer_snapshotFirst_name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotFirst_name OUT, 'customer_snapshot.first_name'
    DECLARE @Grace_period nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Grace_period OUT, 'customer_snapshot.grace_period'
    DECLARE @Due_in_days nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Due_in_days OUT, 'customer_snapshot.due_in_days'
    DECLARE @Group_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Group_id OUT, 'customer_snapshot.group_id'
    DECLARE @Id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Id OUT, 'customer_snapshot.id'
    DECLARE @Info_1 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Info_1 OUT, 'customer_snapshot.info_1'
    DECLARE @Info_2 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Info_2 OUT, 'customer_snapshot.info_2'
    DECLARE @Internet nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Internet OUT, 'customer_snapshot.internet'
    DECLARE @Login_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Login_id OUT, 'customer_snapshot.login_id'
    DECLARE @Mobile nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Mobile OUT, 'customer_snapshot.mobile'
    DECLARE @Note nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Note OUT, 'customer_snapshot.note'
    DECLARE @v_Number nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_Number OUT, 'customer_snapshot.number'
    DECLARE @Payment_options int
    EXEC sp_OAMethod @jResp, 'IntOf', @Payment_options OUT, 'customer_snapshot.payment_options'
    DECLARE @customer_snapshotPersonal int
    EXEC sp_OAMethod @jResp, 'BoolOf', @customer_snapshotPersonal OUT, 'customer_snapshot.personal'
    DECLARE @Phone_1 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Phone_1 OUT, 'customer_snapshot.phone_1'
    DECLARE @Phone_2 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Phone_2 OUT, 'customer_snapshot.phone_2'
    DECLARE @Postbox nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Postbox OUT, 'customer_snapshot.postbox'
    DECLARE @Postbox_city nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Postbox_city OUT, 'customer_snapshot.postbox_city'
    DECLARE @Postbox_state nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Postbox_state OUT, 'customer_snapshot.postbox_state'
    DECLARE @Postbox_country nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Postbox_country OUT, 'customer_snapshot.postbox_country'
    DECLARE @Postbox_zip_code nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Postbox_zip_code OUT, 'customer_snapshot.postbox_zip_code'
    DECLARE @Sale_price_level nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Sale_price_level OUT, 'customer_snapshot.sale_price_level'
    DECLARE @customer_snapshotSalutation int
    EXEC sp_OAMethod @jResp, 'IntOf', @customer_snapshotSalutation OUT, 'customer_snapshot.salutation'
    DECLARE @Sepa_agreement nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Sepa_agreement OUT, 'customer_snapshot.sepa_agreement'
    DECLARE @Sepa_agreement_date nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Sepa_agreement_date OUT, 'customer_snapshot.sepa_agreement_date'
    DECLARE @Sepa_mandate_reference nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Sepa_mandate_reference OUT, 'customer_snapshot.sepa_mandate_reference'
    DECLARE @Since_date nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Since_date OUT, 'customer_snapshot.since_date'
    DECLARE @customer_snapshotStreet nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotStreet OUT, 'customer_snapshot.street'
    DECLARE @customer_snapshotSuffix_1 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotSuffix_1 OUT, 'customer_snapshot.suffix_1'
    DECLARE @customer_snapshotSuffix_2 nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotSuffix_2 OUT, 'customer_snapshot.suffix_2'
    DECLARE @Tax_number nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Tax_number OUT, 'customer_snapshot.tax_number'
    DECLARE @Court nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Court OUT, 'customer_snapshot.court'
    DECLARE @Court_registry_number nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Court_registry_number OUT, 'customer_snapshot.court_registry_number'
    DECLARE @Tax_options nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Tax_options OUT, 'customer_snapshot.tax_options'
    DECLARE @customer_snapshotTitle nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotTitle OUT, 'customer_snapshot.title'
    DECLARE @Archived nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Archived OUT, 'customer_snapshot.archived'
    DECLARE @Vat_identifier nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Vat_identifier OUT, 'customer_snapshot.vat_identifier'
    DECLARE @customer_snapshotZip_code nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @customer_snapshotZip_code OUT, 'customer_snapshot.zip_code'
    DECLARE @Document_pdf_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Document_pdf_type OUT, 'customer_snapshot.document_pdf_type'
    DECLARE @Buyer_reference nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Buyer_reference OUT, 'customer_snapshot.buyer_reference'
    DECLARE @Foreign_supplier_number nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Foreign_supplier_number OUT, 'customer_snapshot.foreign_supplier_number'
    DECLARE @discount nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @discount OUT, 'discount'
    DECLARE @discount_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @discount_type OUT, 'discount_type'
    DECLARE @document_date nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @document_date OUT, 'document_date'
    DECLARE @due_date nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @due_date OUT, 'due_date'
    DECLARE @edited_at nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @edited_at OUT, 'edited_at'
    DECLARE @external_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @external_id OUT, 'external_id'
    DECLARE @replica_url nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @replica_url OUT, 'replica_url'
    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 @id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'id'
    DECLARE @is_acceptable_on_public_domain int
    EXEC sp_OAMethod @jResp, 'BoolOf', @is_acceptable_on_public_domain OUT, 'is_acceptable_on_public_domain'
    DECLARE @is_archive int
    EXEC sp_OAMethod @jResp, 'BoolOf', @is_archive OUT, 'is_archive'
    DECLARE @is_draft nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @is_draft OUT, 'is_draft'
    DECLARE @is_replica int
    EXEC sp_OAMethod @jResp, 'BoolOf', @is_replica OUT, 'is_replica'
    DECLARE @is_oss int
    EXEC sp_OAMethod @jResp, 'BoolOf', @is_oss OUT, 'is_oss'
    DECLARE @last_postbox_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @last_postbox_id OUT, 'last_postbox_id'
    DECLARE @login_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @login_id OUT, 'login_id'
    DECLARE @v_number nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_number OUT, 'number'
    DECLARE @order_number nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @order_number OUT, 'order_number'
    DECLARE @buyer_reference nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @buyer_reference OUT, 'buyer_reference'
    DECLARE @paid_amount nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @paid_amount OUT, 'paid_amount'
    DECLARE @paid_at nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @paid_at OUT, 'paid_at'
    DECLARE @pdf_pages nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @pdf_pages OUT, 'pdf_pages'
    DECLARE @pdf_template nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @pdf_template OUT, 'pdf_template'
    DECLARE @project_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @project_id OUT, 'project_id'
    DECLARE @Next_date nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Next_date OUT, 'recurring_options.next_date'
    DECLARE @Frequency nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Frequency OUT, 'recurring_options.frequency'
    DECLARE @Frequency_special nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Frequency_special OUT, 'recurring_options.frequency_special'
    DECLARE @Interval int
    EXEC sp_OAMethod @jResp, 'IntOf', @Interval OUT, 'recurring_options.interval'
    DECLARE @End_date_or_count nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @End_date_or_count OUT, 'recurring_options.end_date_or_count'
    DECLARE @Status nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Status OUT, 'recurring_options.status'
    DECLARE @As_draft int
    EXEC sp_OAMethod @jResp, 'BoolOf', @As_draft OUT, 'recurring_options.as_draft'
    DECLARE @Is_notify int
    EXEC sp_OAMethod @jResp, 'BoolOf', @Is_notify OUT, 'recurring_options.is_notify'
    DECLARE @Send_as nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Send_as OUT, 'recurring_options.send_as'
    DECLARE @Is_sign int
    EXEC sp_OAMethod @jResp, 'BoolOf', @Is_sign OUT, 'recurring_options.is_sign'
    DECLARE @Is_paid int
    EXEC sp_OAMethod @jResp, 'BoolOf', @Is_paid OUT, 'recurring_options.is_paid'
    DECLARE @Paid_date_option nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Paid_date_option OUT, 'recurring_options.paid_date_option'
    DECLARE @Is_sepa int
    EXEC sp_OAMethod @jResp, 'BoolOf', @Is_sepa OUT, 'recurring_options.is_sepa'
    DECLARE @Sepa_local_instrument nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Sepa_local_instrument OUT, 'recurring_options.sepa_local_instrument'
    DECLARE @Sepa_sequence_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Sepa_sequence_type OUT, 'recurring_options.sepa_sequence_type'
    DECLARE @Sepa_reference nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Sepa_reference OUT, 'recurring_options.sepa_reference'
    DECLARE @Sepa_remittance_information nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Sepa_remittance_information OUT, 'recurring_options.sepa_remittance_information'
    DECLARE @Target_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Target_type OUT, 'recurring_options.target_type'
    DECLARE @ref_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @ref_id OUT, 'ref_id'
    DECLARE @root_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @root_id OUT, 'root_id'
    DECLARE @v_Type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_Type OUT, 'service_date.type'
    DECLARE @Date nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Date OUT, 'service_date.date'
    EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'service_date.date_from', 0, @Date_from
    EXEC sp_OAMethod @jResp, 'DtOf', @success OUT, 'service_date.date_to', 0, @Date_to
    DECLARE @Text nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Text OUT, 'service_date.text'
    DECLARE @shipping_country nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @shipping_country OUT, 'shipping_country'
    DECLARE @status nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'status'
    DECLARE @text nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @text OUT, 'text'
    DECLARE @text_prefix nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @text_prefix OUT, 'text_prefix'
    DECLARE @text_tax nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @text_tax OUT, 'text_tax'
    DECLARE @title nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @title OUT, 'title'
    DECLARE @v_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'type'
    DECLARE @use_shipping_address int
    EXEC sp_OAMethod @jResp, 'BoolOf', @use_shipping_address OUT, 'use_shipping_address'
    DECLARE @vat_country nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @vat_country OUT, 'vat_country'
    DECLARE @vat_id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @vat_id OUT, 'vat_id'
    DECLARE @fulfillment_country nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @fulfillment_country OUT, 'fulfillment_country'
    DECLARE @vat_option nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @vat_option OUT, 'vat_option'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'attachment_ids'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'attachment_ids[i]'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'customer_snapshot.additional_groups_ids'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'customer_snapshot.additional_groups_ids[i]'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'customer_snapshot.emails'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'customer_snapshot.emails[i]'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'item_notes'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'item_notes[i]'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'items'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @v_number OUT, 'items[i].number'
        EXEC sp_OAMethod @jResp, 'StringOf', @description OUT, 'items[i].description'
        EXEC sp_OAMethod @jResp, 'StringOf', @document_note OUT, 'items[i].document_note'
        EXEC sp_OAMethod @jResp, 'IntOf', @quantity OUT, 'items[i].quantity'
        EXEC sp_OAMethod @jResp, 'StringOf', @quantity_str OUT, 'items[i].quantity_str'
        EXEC sp_OAMethod @jResp, 'StringOf', @unit OUT, 'items[i].unit'
        EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'items[i].type'
        EXEC sp_OAMethod @jResp, 'StringOf', @position OUT, 'items[i].position'
        EXEC sp_OAMethod @jResp, 'StringOf', @single_price_net OUT, 'items[i].single_price_net'
        EXEC sp_OAMethod @jResp, 'StringOf', @single_price_gross OUT, 'items[i].single_price_gross'
        EXEC sp_OAMethod @jResp, 'IntOf', @vat_percent OUT, 'items[i].vat_percent'
        EXEC sp_OAMethod @jResp, 'StringOf', @discount OUT, 'items[i].discount'
        EXEC sp_OAMethod @jResp, 'StringOf', @discount_type OUT, 'items[i].discount_type'
        EXEC sp_OAMethod @jResp, 'StringOf', @position_id OUT, 'items[i].position_id'
        EXEC sp_OAMethod @jResp, 'StringOf', @total_price_net OUT, 'items[i].total_price_net'
        EXEC sp_OAMethod @jResp, 'StringOf', @total_price_gross OUT, 'items[i].total_price_gross'
        EXEC sp_OAMethod @jResp, 'StringOf', @total_vat OUT, 'items[i].total_vat'
        EXEC sp_OAMethod @jResp, 'StringOf', @serial_number_id OUT, 'items[i].serial_number_id'
        EXEC sp_OAMethod @jResp, 'StringOf', @serial_number OUT, 'items[i].serial_number'
        EXEC sp_OAMethod @jResp, 'StringOf', @booking_account OUT, 'items[i].booking_account'
        EXEC sp_OAMethod @jResp, 'StringOf', @export_cost_1 OUT, 'items[i].export_cost_1'
        EXEC sp_OAMethod @jResp, 'StringOf', @export_cost_2 OUT, 'items[i].export_cost_2'
        EXEC sp_OAMethod @jResp, 'StringOf', @cost_price_net OUT, 'items[i].cost_price_net'
        EXEC sp_OAMethod @jResp, 'StringOf', @cost_price_total OUT, 'items[i].cost_price_total'
        EXEC sp_OAMethod @jResp, 'StringOf', @cost_price_charge OUT, 'items[i].cost_price_charge'
        EXEC sp_OAMethod @jResp, 'StringOf', @cost_price_charge_type OUT, 'items[i].cost_price_charge_type'
        EXEC sp_OAMethod @jResp, 'StringOf', @itemType OUT, 'items[i].itemType'
        EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'items[i].id'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'file_format_config'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'file_format_config[i].type'
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp
    EXEC @hr = sp_OADestroy @Date_from
    EXEC @hr = sp_OADestroy @Date_to


END
GO

Curl Command

curl -X PUT
	-H "Authorization: {{apiKey}}"
	-H "Accept: application/json"
https://api.easybill.de/rest/v1/documents/:id/done?reason_for_change=<string>

Postman Collection Item JSON

{
  "name": "To complete a document.",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/documents/:id/done?reason_for_change=<string>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "documents",
        ":id",
        "done"
      ],
      "query": [
        {
          "key": "reason_for_change",
          "value": "<string>",
          "description": "A string that is saved on the document version as reason."
        }
      ],
      "variable": [
        {
          "key": "id",
          "value": "<long>",
          "description": "(Required) ID of document"
        }
      ]
    }
  },
  "response": [
    {
      "name": "Successful operation",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id/done?reason_for_change=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id",
            "done"
          ],
          "query": [
            {
              "key": "reason_for_change",
              "value": "<string>",
              "description": "A string that is saved on the document version as reason."
            }
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"address\": {\n    \"salutation\": \"<integer>\",\n    \"personal\": \"<boolean>\",\n    \"title\": \"<string>\",\n    \"first_name\": \"<string>\",\n    \"last_name\": \"<string>\",\n    \"suffix_1\": \"<string>\",\n    \"suffix_2\": \"<string>\",\n    \"company_name\": \"<string>\",\n    \"street\": \"<string>\",\n    \"zip_code\": \"<string>\",\n    \"city\": \"<string>\",\n    \"state\": \"<string>\",\n    \"country\": \"<string>\"\n  },\n  \"attachment_ids\": [\n    \"<integer>\",\n    \"<integer>\"\n  ],\n  \"label_address\": {\n    \"salutation\": \"<integer>\",\n    \"personal\": \"<boolean>\",\n    \"title\": \"<string>\",\n    \"first_name\": \"<string>\",\n    \"last_name\": \"<string>\",\n    \"suffix_1\": \"<string>\",\n    \"suffix_2\": \"<string>\",\n    \"company_name\": \"<string>\",\n    \"street\": \"<string>\",\n    \"zip_code\": \"<string>\",\n    \"city\": \"<string>\",\n    \"state\": \"<string>\",\n    \"country\": \"<string>\"\n  },\n  \"amount\": \"<integer>\",\n  \"amount_net\": \"<integer>\",\n  \"bank_debit_form\": null,\n  \"billing_country\": \"<string>\",\n  \"calc_vat_from\": 0,\n  \"cancel_id\": \"<long>\",\n  \"cash_allowance\": null,\n  \"cash_allowance_days\": null,\n  \"cash_allowance_text\": null,\n  \"contact_id\": null,\n  \"contact_label\": \"\",\n  \"contact_text\": \"\",\n  \"created_at\": \"<dateTime>\",\n  \"currency\": \"EUR\",\n  \"customer_id\": null,\n  \"customer_snapshot\": {\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\": 1,\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\": \"SALEPRICE6\",\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\": \"nStbIm\",\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  },\n  \"discount\": null,\n  \"discount_type\": null,\n  \"document_date\": \"<date>\",\n  \"due_date\": \"<date>\",\n  \"edited_at\": \"<dateTime>\",\n  \"external_id\": null,\n  \"replica_url\": null,\n  \"grace_period\": \"<integer>\",\n  \"due_in_days\": \"<integer>\",\n  \"id\": \"<long>\",\n  \"is_acceptable_on_public_domain\": false,\n  \"is_archive\": false,\n  \"is_draft\": \"<boolean>\",\n  \"is_replica\": false,\n  \"is_oss\": false,\n  \"item_notes\": [\n    \"<string>\",\n    \"<string>\"\n  ],\n  \"items\": [\n    {\n      \"number\": null,\n      \"description\": null,\n      \"document_note\": \"<string>\",\n      \"quantity\": 1,\n      \"quantity_str\": \"<string>\",\n      \"unit\": null,\n      \"type\": \"POSITION\",\n      \"position\": \"<integer>\",\n      \"single_price_net\": null,\n      \"single_price_gross\": \"<float>\",\n      \"vat_percent\": 0,\n      \"discount\": null,\n      \"discount_type\": null,\n      \"position_id\": null,\n      \"total_price_net\": \"<float>\",\n      \"total_price_gross\": \"<float>\",\n      \"total_vat\": \"<float>\",\n      \"serial_number_id\": \"<string>\",\n      \"serial_number\": \"<string>\",\n      \"booking_account\": null,\n      \"export_cost_1\": null,\n      \"export_cost_2\": null,\n      \"cost_price_net\": null,\n      \"cost_price_total\": \"<float>\",\n      \"cost_price_charge\": \"<float>\",\n      \"cost_price_charge_type\": \"PERCENT\",\n      \"itemType\": \"UNDEFINED\",\n      \"id\": \"<long>\"\n    },\n    {\n      \"number\": null,\n      \"description\": null,\n      \"document_note\": \"<string>\",\n      \"quantity\": 1,\n      \"quantity_str\": \"<string>\",\n      \"unit\": null,\n      \"type\": \"POSITION\",\n      \"position\": \"<integer>\",\n      \"single_price_net\": null,\n      \"single_price_gross\": \"<float>\",\n      \"vat_percent\": 0,\n      \"discount\": null,\n      \"discount_type\": null,\n      \"position_id\": null,\n      \"total_price_net\": \"<float>\",\n      \"total_price_gross\": \"<float>\",\n      \"total_vat\": \"<float>\",\n      \"serial_number_id\": \"<string>\",\n      \"serial_number\": \"<string>\",\n      \"booking_account\": null,\n      \"export_cost_1\": null,\n      \"export_cost_2\": null,\n      \"cost_price_net\": null,\n      \"cost_price_total\": \"<float>\",\n      \"cost_price_charge\": \"<float>\",\n      \"cost_price_charge_type\": \"PERCENT\",\n      \"itemType\": \"UNDEFINED\",\n      \"id\": \"<long>\"\n    }\n  ],\n  \"last_postbox_id\": \"<long>\",\n  \"login_id\": \"<long>\",\n  \"number\": null,\n  \"order_number\": \"\",\n  \"buyer_reference\": \"\",\n  \"paid_amount\": \"<integer>\",\n  \"paid_at\": \"<date>\",\n  \"pdf_pages\": \"<integer>\",\n  \"pdf_template\": \"<string>\",\n  \"project_id\": null,\n  \"recurring_options\": {\n    \"next_date\": \"<date>\",\n    \"frequency\": \"MONTHLY\",\n    \"frequency_special\": null,\n    \"interval\": 1,\n    \"end_date_or_count\": null,\n    \"status\": \"WAITING\",\n    \"as_draft\": false,\n    \"is_notify\": false,\n    \"send_as\": null,\n    \"is_sign\": false,\n    \"is_paid\": false,\n    \"paid_date_option\": \"created_date\",\n    \"is_sepa\": false,\n    \"sepa_local_instrument\": null,\n    \"sepa_sequence_type\": null,\n    \"sepa_reference\": null,\n    \"sepa_remittance_information\": null,\n    \"target_type\": \"INVOICE\"\n  },\n  \"ref_id\": null,\n  \"root_id\": null,\n  \"service_date\": {\n    \"type\": \"SERVICE\",\n    \"date\": \"<date>\",\n    \"date_from\": \"<date>\",\n    \"date_to\": \"<date>\",\n    \"text\": null\n  },\n  \"shipping_country\": null,\n  \"status\": null,\n  \"text\": \"<string>\",\n  \"text_prefix\": \"<string>\",\n  \"text_tax\": null,\n  \"title\": null,\n  \"type\": \"INVOICE\",\n  \"use_shipping_address\": false,\n  \"vat_country\": null,\n  \"vat_id\": \"\",\n  \"fulfillment_country\": null,\n  \"vat_option\": null,\n  \"file_format_config\": [\n    {\n      \"type\": \"xrechnung2_2_xml\"\n    },\n    {\n      \"type\": \"xrechnung3_0_xml\"\n    }\n  ]\n}"
    },
    {
      "name": "Not found",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id/done?reason_for_change=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id",
            "done"
          ],
          "query": [
            {
              "key": "reason_for_change",
              "value": "<string>",
              "description": "A string that is saved on the document version as reason."
            }
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Resource is locked. This status is returned if a process is currently running which locks the requested resource. Try again later.",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id/done?reason_for_change=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id",
            "done"
          ],
          "query": [
            {
              "key": "reason_for_change",
              "value": "<string>",
              "description": "A string that is saved on the document version as reason."
            }
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Conflict",
      "code": 409,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Too Many Requests",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id/done?reason_for_change=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id",
            "done"
          ],
          "query": [
            {
              "key": "reason_for_change",
              "value": "<string>",
              "description": "A string that is saved on the document version as reason."
            }
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}