PureBasic / easybill REST API / Convert an existing document to one of a different type
Back to Collection Items
IncludeFile "CkJsonObject.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
IncludeFile "CkDtObj.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
CkHttp::ckSetRequestHeader(http,"Authorization","{{apiKey}}")
CkHttp::ckSetRequestHeader(http,"Accept","application/json")
resp.i = CkHttp::ckQuickRequest(http,"POST","https://api.easybill.de/rest/v1/documents/:id/:type?pdf_template=DE")
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
ProcedureReturn
EndIf
sbResponseBody.i = CkStringBuilder::ckCreate()
If sbResponseBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkHttpResponse::ckGetBodySb(resp,sbResponseBody)
jResp.i = CkJsonObject::ckCreate()
If jResp.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoadSb(jResp,sbResponseBody)
CkJsonObject::setCkEmitCompact(jResp, 0)
Debug "Response Body:"
Debug CkJsonObject::ckEmit(jResp)
respStatusCode.i = CkHttpResponse::ckStatusCode(resp)
Debug "Response Status Code = " + Str(respStatusCode)
If respStatusCode >= 400
Debug "Response Header:"
Debug CkHttpResponse::ckHeader(resp)
Debug "Failed."
CkHttpResponse::ckDispose(resp)
CkHttp::ckDispose(http)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndIf
CkHttpResponse::ckDispose(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
Date_from.i = CkDtObj::ckCreate()
If Date_from.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
Date_to.i = CkDtObj::ckCreate()
If Date_to.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
strVal.s
description.s
document_note.s
quantity.i
quantity_str.s
unit.s
position.s
single_price_net.s
single_price_gross.s
vat_percent.i
position_id.s
total_price_net.s
total_price_gross.s
total_vat.s
serial_number_id.s
serial_number.s
booking_account.s
export_cost_1.s
export_cost_2.s
cost_price_net.s
cost_price_total.s
cost_price_charge.s
cost_price_charge_type.s
itemType.s
Salutation.s = CkJsonObject::ckStringOf(jResp,"address.salutation")
Personal.s = CkJsonObject::ckStringOf(jResp,"address.personal")
Title.s = CkJsonObject::ckStringOf(jResp,"address.title")
First_name.s = CkJsonObject::ckStringOf(jResp,"address.first_name")
Last_name.s = CkJsonObject::ckStringOf(jResp,"address.last_name")
Suffix_1.s = CkJsonObject::ckStringOf(jResp,"address.suffix_1")
Suffix_2.s = CkJsonObject::ckStringOf(jResp,"address.suffix_2")
Company_name.s = CkJsonObject::ckStringOf(jResp,"address.company_name")
Street.s = CkJsonObject::ckStringOf(jResp,"address.street")
Zip_code.s = CkJsonObject::ckStringOf(jResp,"address.zip_code")
City.s = CkJsonObject::ckStringOf(jResp,"address.city")
State.s = CkJsonObject::ckStringOf(jResp,"address.state")
Country.s = CkJsonObject::ckStringOf(jResp,"address.country")
label_addressSalutation.s = CkJsonObject::ckStringOf(jResp,"label_address.salutation")
label_addressPersonal.s = CkJsonObject::ckStringOf(jResp,"label_address.personal")
label_addressTitle.s = CkJsonObject::ckStringOf(jResp,"label_address.title")
label_addressFirst_name.s = CkJsonObject::ckStringOf(jResp,"label_address.first_name")
label_addressLast_name.s = CkJsonObject::ckStringOf(jResp,"label_address.last_name")
label_addressSuffix_1.s = CkJsonObject::ckStringOf(jResp,"label_address.suffix_1")
label_addressSuffix_2.s = CkJsonObject::ckStringOf(jResp,"label_address.suffix_2")
label_addressCompany_name.s = CkJsonObject::ckStringOf(jResp,"label_address.company_name")
label_addressStreet.s = CkJsonObject::ckStringOf(jResp,"label_address.street")
label_addressZip_code.s = CkJsonObject::ckStringOf(jResp,"label_address.zip_code")
label_addressCity.s = CkJsonObject::ckStringOf(jResp,"label_address.city")
label_addressState.s = CkJsonObject::ckStringOf(jResp,"label_address.state")
label_addressCountry.s = CkJsonObject::ckStringOf(jResp,"label_address.country")
amount.s = CkJsonObject::ckStringOf(jResp,"amount")
amount_net.s = CkJsonObject::ckStringOf(jResp,"amount_net")
bank_debit_form.s = CkJsonObject::ckStringOf(jResp,"bank_debit_form")
billing_country.s = CkJsonObject::ckStringOf(jResp,"billing_country")
calc_vat_from.i = CkJsonObject::ckIntOf(jResp,"calc_vat_from")
cancel_id.s = CkJsonObject::ckStringOf(jResp,"cancel_id")
cash_allowance.s = CkJsonObject::ckStringOf(jResp,"cash_allowance")
cash_allowance_days.s = CkJsonObject::ckStringOf(jResp,"cash_allowance_days")
cash_allowance_text.s = CkJsonObject::ckStringOf(jResp,"cash_allowance_text")
contact_id.s = CkJsonObject::ckStringOf(jResp,"contact_id")
contact_label.s = CkJsonObject::ckStringOf(jResp,"contact_label")
contact_text.s = CkJsonObject::ckStringOf(jResp,"contact_text")
created_at.s = CkJsonObject::ckStringOf(jResp,"created_at")
v_currency.s = CkJsonObject::ckStringOf(jResp,"currency")
customer_id.s = CkJsonObject::ckStringOf(jResp,"customer_id")
customer_snapshotLast_name.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.last_name")
customer_snapshotCompany_name.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.company_name")
Acquire_options.i = CkJsonObject::ckIntOf(jResp,"customer_snapshot.acquire_options")
Bank_account.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.bank_account")
Bank_account_owner.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.bank_account_owner")
Bank_bic.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.bank_bic")
Bank_code.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.bank_code")
Bank_iban.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.bank_iban")
Bank_name.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.bank_name")
Birth_date.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.birth_date")
Cash_allowance.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.cash_allowance")
Cash_allowance_days.i = CkJsonObject::ckIntOf(jResp,"customer_snapshot.cash_allowance_days")
Cash_discount.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.cash_discount")
Cash_discount_type.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.cash_discount_type")
customer_snapshotCity.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.city")
customer_snapshotState.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.state")
customer_snapshotCountry.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.country")
Created_at.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.created_at")
Updated_at.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.updated_at")
Delivery_title.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_title")
Delivery_city.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_city")
Delivery_state.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_state")
Delivery_company_name.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_company_name")
Delivery_country.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_country")
Delivery_first_name.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_first_name")
Delivery_last_name.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_last_name")
Delivery_personal.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_personal")
Delivery_salutation.i = CkJsonObject::ckIntOf(jResp,"customer_snapshot.delivery_salutation")
Delivery_street.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_street")
Delivery_suffix_1.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_suffix_1")
Delivery_suffix_2.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_suffix_2")
Delivery_zip_code.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.delivery_zip_code")
Display_name.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.display_name")
Fax.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.fax")
customer_snapshotFirst_name.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.first_name")
Grace_period.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.grace_period")
Due_in_days.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.due_in_days")
Group_id.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.group_id")
Id.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.id")
Info_1.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.info_1")
Info_2.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.info_2")
Internet.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.internet")
Login_id.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.login_id")
Mobile.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.mobile")
Note.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.note")
v_Number.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.number")
Payment_options.i = CkJsonObject::ckIntOf(jResp,"customer_snapshot.payment_options")
customer_snapshotPersonal.i = CkJsonObject::ckBoolOf(jResp,"customer_snapshot.personal")
Phone_1.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.phone_1")
Phone_2.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.phone_2")
Postbox.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.postbox")
Postbox_city.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.postbox_city")
Postbox_state.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.postbox_state")
Postbox_country.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.postbox_country")
Postbox_zip_code.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.postbox_zip_code")
Sale_price_level.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.sale_price_level")
customer_snapshotSalutation.i = CkJsonObject::ckIntOf(jResp,"customer_snapshot.salutation")
Sepa_agreement.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.sepa_agreement")
Sepa_agreement_date.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.sepa_agreement_date")
Sepa_mandate_reference.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.sepa_mandate_reference")
Since_date.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.since_date")
customer_snapshotStreet.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.street")
customer_snapshotSuffix_1.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.suffix_1")
customer_snapshotSuffix_2.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.suffix_2")
Tax_number.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.tax_number")
Court.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.court")
Court_registry_number.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.court_registry_number")
Tax_options.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.tax_options")
customer_snapshotTitle.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.title")
Archived.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.archived")
Vat_identifier.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.vat_identifier")
customer_snapshotZip_code.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.zip_code")
Document_pdf_type.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.document_pdf_type")
Buyer_reference.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.buyer_reference")
Foreign_supplier_number.s = CkJsonObject::ckStringOf(jResp,"customer_snapshot.foreign_supplier_number")
discount.s = CkJsonObject::ckStringOf(jResp,"discount")
discount_type.s = CkJsonObject::ckStringOf(jResp,"discount_type")
document_date.s = CkJsonObject::ckStringOf(jResp,"document_date")
due_date.s = CkJsonObject::ckStringOf(jResp,"due_date")
edited_at.s = CkJsonObject::ckStringOf(jResp,"edited_at")
external_id.s = CkJsonObject::ckStringOf(jResp,"external_id")
replica_url.s = CkJsonObject::ckStringOf(jResp,"replica_url")
grace_period.s = CkJsonObject::ckStringOf(jResp,"grace_period")
due_in_days.s = CkJsonObject::ckStringOf(jResp,"due_in_days")
id.s = CkJsonObject::ckStringOf(jResp,"id")
is_acceptable_on_public_domain.i = CkJsonObject::ckBoolOf(jResp,"is_acceptable_on_public_domain")
is_archive.i = CkJsonObject::ckBoolOf(jResp,"is_archive")
is_draft.s = CkJsonObject::ckStringOf(jResp,"is_draft")
is_replica.i = CkJsonObject::ckBoolOf(jResp,"is_replica")
is_oss.i = CkJsonObject::ckBoolOf(jResp,"is_oss")
last_postbox_id.s = CkJsonObject::ckStringOf(jResp,"last_postbox_id")
login_id.s = CkJsonObject::ckStringOf(jResp,"login_id")
v_number.s = CkJsonObject::ckStringOf(jResp,"number")
order_number.s = CkJsonObject::ckStringOf(jResp,"order_number")
buyer_reference.s = CkJsonObject::ckStringOf(jResp,"buyer_reference")
paid_amount.s = CkJsonObject::ckStringOf(jResp,"paid_amount")
paid_at.s = CkJsonObject::ckStringOf(jResp,"paid_at")
pdf_pages.s = CkJsonObject::ckStringOf(jResp,"pdf_pages")
pdf_template.s = CkJsonObject::ckStringOf(jResp,"pdf_template")
project_id.s = CkJsonObject::ckStringOf(jResp,"project_id")
Next_date.s = CkJsonObject::ckStringOf(jResp,"recurring_options.next_date")
Frequency.s = CkJsonObject::ckStringOf(jResp,"recurring_options.frequency")
Frequency_special.s = CkJsonObject::ckStringOf(jResp,"recurring_options.frequency_special")
Interval.i = CkJsonObject::ckIntOf(jResp,"recurring_options.interval")
End_date_or_count.s = CkJsonObject::ckStringOf(jResp,"recurring_options.end_date_or_count")
Status.s = CkJsonObject::ckStringOf(jResp,"recurring_options.status")
As_draft.i = CkJsonObject::ckBoolOf(jResp,"recurring_options.as_draft")
Is_notify.i = CkJsonObject::ckBoolOf(jResp,"recurring_options.is_notify")
Send_as.s = CkJsonObject::ckStringOf(jResp,"recurring_options.send_as")
Is_sign.i = CkJsonObject::ckBoolOf(jResp,"recurring_options.is_sign")
Is_paid.i = CkJsonObject::ckBoolOf(jResp,"recurring_options.is_paid")
Paid_date_option.s = CkJsonObject::ckStringOf(jResp,"recurring_options.paid_date_option")
Is_sepa.i = CkJsonObject::ckBoolOf(jResp,"recurring_options.is_sepa")
Sepa_local_instrument.s = CkJsonObject::ckStringOf(jResp,"recurring_options.sepa_local_instrument")
Sepa_sequence_type.s = CkJsonObject::ckStringOf(jResp,"recurring_options.sepa_sequence_type")
Sepa_reference.s = CkJsonObject::ckStringOf(jResp,"recurring_options.sepa_reference")
Sepa_remittance_information.s = CkJsonObject::ckStringOf(jResp,"recurring_options.sepa_remittance_information")
Target_type.s = CkJsonObject::ckStringOf(jResp,"recurring_options.target_type")
ref_id.s = CkJsonObject::ckStringOf(jResp,"ref_id")
root_id.s = CkJsonObject::ckStringOf(jResp,"root_id")
v_Type.s = CkJsonObject::ckStringOf(jResp,"service_date.type")
Date.s = CkJsonObject::ckStringOf(jResp,"service_date.date")
CkJsonObject::ckDtOf(jResp,"service_date.date_from",0,Date_from)
CkJsonObject::ckDtOf(jResp,"service_date.date_to",0,Date_to)
Text.s = CkJsonObject::ckStringOf(jResp,"service_date.text")
shipping_country.s = CkJsonObject::ckStringOf(jResp,"shipping_country")
status.s = CkJsonObject::ckStringOf(jResp,"status")
text.s = CkJsonObject::ckStringOf(jResp,"text")
text_prefix.s = CkJsonObject::ckStringOf(jResp,"text_prefix")
text_tax.s = CkJsonObject::ckStringOf(jResp,"text_tax")
title.s = CkJsonObject::ckStringOf(jResp,"title")
v_type.s = CkJsonObject::ckStringOf(jResp,"type")
use_shipping_address.i = CkJsonObject::ckBoolOf(jResp,"use_shipping_address")
vat_country.s = CkJsonObject::ckStringOf(jResp,"vat_country")
vat_id.s = CkJsonObject::ckStringOf(jResp,"vat_id")
fulfillment_country.s = CkJsonObject::ckStringOf(jResp,"fulfillment_country")
vat_option.s = CkJsonObject::ckStringOf(jResp,"vat_option")
i.i = 0
count_i.i = CkJsonObject::ckSizeOfArray(jResp,"attachment_ids")
While i < count_i
CkJsonObject::setCkI(jResp, i)
strVal = CkJsonObject::ckStringOf(jResp,"attachment_ids[i]")
i = i + 1
Wend
i = 0
count_i = CkJsonObject::ckSizeOfArray(jResp,"customer_snapshot.additional_groups_ids")
While i < count_i
CkJsonObject::setCkI(jResp, i)
strVal = CkJsonObject::ckStringOf(jResp,"customer_snapshot.additional_groups_ids[i]")
i = i + 1
Wend
i = 0
count_i = CkJsonObject::ckSizeOfArray(jResp,"customer_snapshot.emails")
While i < count_i
CkJsonObject::setCkI(jResp, i)
strVal = CkJsonObject::ckStringOf(jResp,"customer_snapshot.emails[i]")
i = i + 1
Wend
i = 0
count_i = CkJsonObject::ckSizeOfArray(jResp,"item_notes")
While i < count_i
CkJsonObject::setCkI(jResp, i)
strVal = CkJsonObject::ckStringOf(jResp,"item_notes[i]")
i = i + 1
Wend
i = 0
count_i = CkJsonObject::ckSizeOfArray(jResp,"items")
While i < count_i
CkJsonObject::setCkI(jResp, i)
v_number = CkJsonObject::ckStringOf(jResp,"items[i].number")
description = CkJsonObject::ckStringOf(jResp,"items[i].description")
document_note = CkJsonObject::ckStringOf(jResp,"items[i].document_note")
quantity = CkJsonObject::ckIntOf(jResp,"items[i].quantity")
quantity_str = CkJsonObject::ckStringOf(jResp,"items[i].quantity_str")
unit = CkJsonObject::ckStringOf(jResp,"items[i].unit")
v_type = CkJsonObject::ckStringOf(jResp,"items[i].type")
position = CkJsonObject::ckStringOf(jResp,"items[i].position")
single_price_net = CkJsonObject::ckStringOf(jResp,"items[i].single_price_net")
single_price_gross = CkJsonObject::ckStringOf(jResp,"items[i].single_price_gross")
vat_percent = CkJsonObject::ckIntOf(jResp,"items[i].vat_percent")
discount = CkJsonObject::ckStringOf(jResp,"items[i].discount")
discount_type = CkJsonObject::ckStringOf(jResp,"items[i].discount_type")
position_id = CkJsonObject::ckStringOf(jResp,"items[i].position_id")
total_price_net = CkJsonObject::ckStringOf(jResp,"items[i].total_price_net")
total_price_gross = CkJsonObject::ckStringOf(jResp,"items[i].total_price_gross")
total_vat = CkJsonObject::ckStringOf(jResp,"items[i].total_vat")
serial_number_id = CkJsonObject::ckStringOf(jResp,"items[i].serial_number_id")
serial_number = CkJsonObject::ckStringOf(jResp,"items[i].serial_number")
booking_account = CkJsonObject::ckStringOf(jResp,"items[i].booking_account")
export_cost_1 = CkJsonObject::ckStringOf(jResp,"items[i].export_cost_1")
export_cost_2 = CkJsonObject::ckStringOf(jResp,"items[i].export_cost_2")
cost_price_net = CkJsonObject::ckStringOf(jResp,"items[i].cost_price_net")
cost_price_total = CkJsonObject::ckStringOf(jResp,"items[i].cost_price_total")
cost_price_charge = CkJsonObject::ckStringOf(jResp,"items[i].cost_price_charge")
cost_price_charge_type = CkJsonObject::ckStringOf(jResp,"items[i].cost_price_charge_type")
itemType = CkJsonObject::ckStringOf(jResp,"items[i].itemType")
id = CkJsonObject::ckStringOf(jResp,"items[i].id")
i = i + 1
Wend
i = 0
count_i = CkJsonObject::ckSizeOfArray(jResp,"file_format_config")
While i < count_i
CkJsonObject::setCkI(jResp, i)
v_type = CkJsonObject::ckStringOf(jResp,"file_format_config[i].type")
i = i + 1
Wend
CkHttp::ckDispose(http)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
CkDtObj::ckDispose(Date_from)
CkDtObj::ckDispose(Date_to)
ProcedureReturn
EndProcedure
Curl Command
curl -X POST
-H "Authorization: {{apiKey}}"
-H "Accept: application/json"
https://api.easybill.de/rest/v1/documents/:id/:type?pdf_template=DE
Postman Collection Item JSON
{
"name": "Convert an existing document to one of a different type",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/documents/:id/:type?pdf_template=DE",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
":type"
],
"query": [
{
"key": "pdf_template",
"value": "DE",
"description": "The ID of the printer template to use. Defaults to 'DE' if not given."
}
],
"variable": [
{
"key": "id",
"value": "<long>",
"description": "(Required) ID of document"
},
{
"key": "type",
"value": "DUNNING",
"description": "(Required) The target document type"
}
]
}
},
"response": [
{
"name": "Successful operation",
"originalRequest": {
"method": "POST",
"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/:type?pdf_template=DE",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
":type"
],
"query": [
{
"key": "pdf_template",
"value": "DE",
"description": "The ID of the printer template to use. Defaults to 'DE' if not given."
}
],
"variable": [
{
"key": "id"
},
{
"key": "type"
}
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Location",
"value": "<uri>",
"description": {
"content": "Absolute URL to the newly created document",
"type": "text/plain"
}
}
],
"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": "Invalid target document type",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/documents/:id/:type?pdf_template=DE",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
":type"
],
"query": [
{
"key": "pdf_template",
"value": "DE",
"description": "The ID of the printer template to use. Defaults to 'DE' if not given."
}
],
"variable": [
{
"key": "id"
},
{
"key": "type"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
},
{
"name": "Too Many Requests",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/documents/:id/:type?pdf_template=DE",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
":type"
],
"query": [
{
"key": "pdf_template",
"value": "DE",
"description": "The ID of the printer template to use. Defaults to 'DE' if not given."
}
],
"variable": [
{
"key": "id"
},
{
"key": "type"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}