Chilkat Online Tools

TCL / easybill REST API / To complete a document.

Back to Collection Items

load ./chilkat.dll

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

set http [new_CkHttp]

CkHttp_SetRequestHeader $http "Authorization" "{{apiKey}}"
CkHttp_SetRequestHeader $http "Accept" "application/json"

# resp is a CkHttpResponse
set resp [CkHttp_QuickRequest $http "PUT" "https://api.easybill.de/rest/v1/documents/:id/done?reason_for_change=<string>"]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    exit
}

set sbResponseBody [new_CkStringBuilder]

CkHttpResponse_GetBodySb $resp $sbResponseBody

set jResp [new_CkJsonObject]

CkJsonObject_LoadSb $jResp $sbResponseBody
CkJsonObject_put_EmitCompact $jResp 0

puts "Response Body:"
puts [CkJsonObject_emit $jResp]

set respStatusCode [CkHttpResponse_get_StatusCode $resp]
puts "Response Status Code = $respStatusCode"
if {$respStatusCode >= 400} then {
    puts "Response Header:"
    puts [CkHttpResponse_header $resp]
    puts "Failed."
    delete_CkHttpResponse $resp

    delete_CkHttp $http
    delete_CkStringBuilder $sbResponseBody
    delete_CkJsonObject $jResp
    exit
}

delete_CkHttpResponse $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

set Date_from [new_CkDtObj]

set Date_to [new_CkDtObj]

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

delete_CkHttp $http
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp
delete_CkDtObj $Date_from
delete_CkDtObj $Date_to

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