unicodeCpp / easybill REST API / Convert an existing document to one of a different type
Back to Collection Items
#include <CkHttpW.h>
#include <CkHttpResponseW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
#include <CkDtObjW.h>
void ChilkatSample(void)
{
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttpW http;
bool success;
http.SetRequestHeader(L"Authorization",L"{{apiKey}}");
http.SetRequestHeader(L"Accept",L"application/json");
CkHttpResponseW *resp = http.QuickRequest(L"POST",L"https://api.easybill.de/rest/v1/documents/:id/:type?pdf_template=DE");
if (http.get_LastMethodSuccess() == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
CkStringBuilderW sbResponseBody;
resp->GetBodySb(sbResponseBody);
CkJsonObjectW jResp;
jResp.LoadSb(sbResponseBody);
jResp.put_EmitCompact(false);
wprintf(L"Response Body:\n");
wprintf(L"%s\n",jResp.emit());
int respStatusCode = resp->get_StatusCode();
wprintf(L"Response Status Code = %d\n",respStatusCode);
if (respStatusCode >= 400) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",resp->header());
wprintf(L"Failed.\n");
delete resp;
return;
}
delete 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
// Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
CkDtObjW Date_from;
CkDtObjW Date_to;
const wchar_t *strVal = 0;
const wchar_t *description = 0;
const wchar_t *document_note = 0;
int quantity;
const wchar_t *quantity_str = 0;
const wchar_t *unit = 0;
const wchar_t *position = 0;
const wchar_t *single_price_net = 0;
const wchar_t *single_price_gross = 0;
int vat_percent;
const wchar_t *position_id = 0;
const wchar_t *total_price_net = 0;
const wchar_t *total_price_gross = 0;
const wchar_t *total_vat = 0;
const wchar_t *serial_number_id = 0;
const wchar_t *serial_number = 0;
const wchar_t *booking_account = 0;
const wchar_t *export_cost_1 = 0;
const wchar_t *export_cost_2 = 0;
const wchar_t *cost_price_net = 0;
const wchar_t *cost_price_total = 0;
const wchar_t *cost_price_charge = 0;
const wchar_t *cost_price_charge_type = 0;
const wchar_t *itemType = 0;
const wchar_t *Salutation = jResp.stringOf(L"address.salutation");
const wchar_t *Personal = jResp.stringOf(L"address.personal");
const wchar_t *Title = jResp.stringOf(L"address.title");
const wchar_t *First_name = jResp.stringOf(L"address.first_name");
const wchar_t *Last_name = jResp.stringOf(L"address.last_name");
const wchar_t *Suffix_1 = jResp.stringOf(L"address.suffix_1");
const wchar_t *Suffix_2 = jResp.stringOf(L"address.suffix_2");
const wchar_t *Company_name = jResp.stringOf(L"address.company_name");
const wchar_t *Street = jResp.stringOf(L"address.street");
const wchar_t *Zip_code = jResp.stringOf(L"address.zip_code");
const wchar_t *City = jResp.stringOf(L"address.city");
const wchar_t *State = jResp.stringOf(L"address.state");
const wchar_t *Country = jResp.stringOf(L"address.country");
const wchar_t *label_addressSalutation = jResp.stringOf(L"label_address.salutation");
const wchar_t *label_addressPersonal = jResp.stringOf(L"label_address.personal");
const wchar_t *label_addressTitle = jResp.stringOf(L"label_address.title");
const wchar_t *label_addressFirst_name = jResp.stringOf(L"label_address.first_name");
const wchar_t *label_addressLast_name = jResp.stringOf(L"label_address.last_name");
const wchar_t *label_addressSuffix_1 = jResp.stringOf(L"label_address.suffix_1");
const wchar_t *label_addressSuffix_2 = jResp.stringOf(L"label_address.suffix_2");
const wchar_t *label_addressCompany_name = jResp.stringOf(L"label_address.company_name");
const wchar_t *label_addressStreet = jResp.stringOf(L"label_address.street");
const wchar_t *label_addressZip_code = jResp.stringOf(L"label_address.zip_code");
const wchar_t *label_addressCity = jResp.stringOf(L"label_address.city");
const wchar_t *label_addressState = jResp.stringOf(L"label_address.state");
const wchar_t *label_addressCountry = jResp.stringOf(L"label_address.country");
const wchar_t *amount = jResp.stringOf(L"amount");
const wchar_t *amount_net = jResp.stringOf(L"amount_net");
const wchar_t *bank_debit_form = jResp.stringOf(L"bank_debit_form");
const wchar_t *billing_country = jResp.stringOf(L"billing_country");
int calc_vat_from = jResp.IntOf(L"calc_vat_from");
const wchar_t *cancel_id = jResp.stringOf(L"cancel_id");
const wchar_t *cash_allowance = jResp.stringOf(L"cash_allowance");
const wchar_t *cash_allowance_days = jResp.stringOf(L"cash_allowance_days");
const wchar_t *cash_allowance_text = jResp.stringOf(L"cash_allowance_text");
const wchar_t *contact_id = jResp.stringOf(L"contact_id");
const wchar_t *contact_label = jResp.stringOf(L"contact_label");
const wchar_t *contact_text = jResp.stringOf(L"contact_text");
const wchar_t *created_at = jResp.stringOf(L"created_at");
const wchar_t *v_currency = jResp.stringOf(L"currency");
const wchar_t *customer_id = jResp.stringOf(L"customer_id");
const wchar_t *customer_snapshotLast_name = jResp.stringOf(L"customer_snapshot.last_name");
const wchar_t *customer_snapshotCompany_name = jResp.stringOf(L"customer_snapshot.company_name");
int Acquire_options = jResp.IntOf(L"customer_snapshot.acquire_options");
const wchar_t *Bank_account = jResp.stringOf(L"customer_snapshot.bank_account");
const wchar_t *Bank_account_owner = jResp.stringOf(L"customer_snapshot.bank_account_owner");
const wchar_t *Bank_bic = jResp.stringOf(L"customer_snapshot.bank_bic");
const wchar_t *Bank_code = jResp.stringOf(L"customer_snapshot.bank_code");
const wchar_t *Bank_iban = jResp.stringOf(L"customer_snapshot.bank_iban");
const wchar_t *Bank_name = jResp.stringOf(L"customer_snapshot.bank_name");
const wchar_t *Birth_date = jResp.stringOf(L"customer_snapshot.birth_date");
const wchar_t *Cash_allowance = jResp.stringOf(L"customer_snapshot.cash_allowance");
int Cash_allowance_days = jResp.IntOf(L"customer_snapshot.cash_allowance_days");
const wchar_t *Cash_discount = jResp.stringOf(L"customer_snapshot.cash_discount");
const wchar_t *Cash_discount_type = jResp.stringOf(L"customer_snapshot.cash_discount_type");
const wchar_t *customer_snapshotCity = jResp.stringOf(L"customer_snapshot.city");
const wchar_t *customer_snapshotState = jResp.stringOf(L"customer_snapshot.state");
const wchar_t *customer_snapshotCountry = jResp.stringOf(L"customer_snapshot.country");
const wchar_t *Created_at = jResp.stringOf(L"customer_snapshot.created_at");
const wchar_t *Updated_at = jResp.stringOf(L"customer_snapshot.updated_at");
const wchar_t *Delivery_title = jResp.stringOf(L"customer_snapshot.delivery_title");
const wchar_t *Delivery_city = jResp.stringOf(L"customer_snapshot.delivery_city");
const wchar_t *Delivery_state = jResp.stringOf(L"customer_snapshot.delivery_state");
const wchar_t *Delivery_company_name = jResp.stringOf(L"customer_snapshot.delivery_company_name");
const wchar_t *Delivery_country = jResp.stringOf(L"customer_snapshot.delivery_country");
const wchar_t *Delivery_first_name = jResp.stringOf(L"customer_snapshot.delivery_first_name");
const wchar_t *Delivery_last_name = jResp.stringOf(L"customer_snapshot.delivery_last_name");
const wchar_t *Delivery_personal = jResp.stringOf(L"customer_snapshot.delivery_personal");
int Delivery_salutation = jResp.IntOf(L"customer_snapshot.delivery_salutation");
const wchar_t *Delivery_street = jResp.stringOf(L"customer_snapshot.delivery_street");
const wchar_t *Delivery_suffix_1 = jResp.stringOf(L"customer_snapshot.delivery_suffix_1");
const wchar_t *Delivery_suffix_2 = jResp.stringOf(L"customer_snapshot.delivery_suffix_2");
const wchar_t *Delivery_zip_code = jResp.stringOf(L"customer_snapshot.delivery_zip_code");
const wchar_t *Display_name = jResp.stringOf(L"customer_snapshot.display_name");
const wchar_t *Fax = jResp.stringOf(L"customer_snapshot.fax");
const wchar_t *customer_snapshotFirst_name = jResp.stringOf(L"customer_snapshot.first_name");
const wchar_t *Grace_period = jResp.stringOf(L"customer_snapshot.grace_period");
const wchar_t *Due_in_days = jResp.stringOf(L"customer_snapshot.due_in_days");
const wchar_t *Group_id = jResp.stringOf(L"customer_snapshot.group_id");
const wchar_t *Id = jResp.stringOf(L"customer_snapshot.id");
const wchar_t *Info_1 = jResp.stringOf(L"customer_snapshot.info_1");
const wchar_t *Info_2 = jResp.stringOf(L"customer_snapshot.info_2");
const wchar_t *Internet = jResp.stringOf(L"customer_snapshot.internet");
const wchar_t *Login_id = jResp.stringOf(L"customer_snapshot.login_id");
const wchar_t *Mobile = jResp.stringOf(L"customer_snapshot.mobile");
const wchar_t *Note = jResp.stringOf(L"customer_snapshot.note");
const wchar_t *v_Number = jResp.stringOf(L"customer_snapshot.number");
int Payment_options = jResp.IntOf(L"customer_snapshot.payment_options");
bool customer_snapshotPersonal = jResp.BoolOf(L"customer_snapshot.personal");
const wchar_t *Phone_1 = jResp.stringOf(L"customer_snapshot.phone_1");
const wchar_t *Phone_2 = jResp.stringOf(L"customer_snapshot.phone_2");
const wchar_t *Postbox = jResp.stringOf(L"customer_snapshot.postbox");
const wchar_t *Postbox_city = jResp.stringOf(L"customer_snapshot.postbox_city");
const wchar_t *Postbox_state = jResp.stringOf(L"customer_snapshot.postbox_state");
const wchar_t *Postbox_country = jResp.stringOf(L"customer_snapshot.postbox_country");
const wchar_t *Postbox_zip_code = jResp.stringOf(L"customer_snapshot.postbox_zip_code");
const wchar_t *Sale_price_level = jResp.stringOf(L"customer_snapshot.sale_price_level");
int customer_snapshotSalutation = jResp.IntOf(L"customer_snapshot.salutation");
const wchar_t *Sepa_agreement = jResp.stringOf(L"customer_snapshot.sepa_agreement");
const wchar_t *Sepa_agreement_date = jResp.stringOf(L"customer_snapshot.sepa_agreement_date");
const wchar_t *Sepa_mandate_reference = jResp.stringOf(L"customer_snapshot.sepa_mandate_reference");
const wchar_t *Since_date = jResp.stringOf(L"customer_snapshot.since_date");
const wchar_t *customer_snapshotStreet = jResp.stringOf(L"customer_snapshot.street");
const wchar_t *customer_snapshotSuffix_1 = jResp.stringOf(L"customer_snapshot.suffix_1");
const wchar_t *customer_snapshotSuffix_2 = jResp.stringOf(L"customer_snapshot.suffix_2");
const wchar_t *Tax_number = jResp.stringOf(L"customer_snapshot.tax_number");
const wchar_t *Court = jResp.stringOf(L"customer_snapshot.court");
const wchar_t *Court_registry_number = jResp.stringOf(L"customer_snapshot.court_registry_number");
const wchar_t *Tax_options = jResp.stringOf(L"customer_snapshot.tax_options");
const wchar_t *customer_snapshotTitle = jResp.stringOf(L"customer_snapshot.title");
const wchar_t *Archived = jResp.stringOf(L"customer_snapshot.archived");
const wchar_t *Vat_identifier = jResp.stringOf(L"customer_snapshot.vat_identifier");
const wchar_t *customer_snapshotZip_code = jResp.stringOf(L"customer_snapshot.zip_code");
const wchar_t *Document_pdf_type = jResp.stringOf(L"customer_snapshot.document_pdf_type");
const wchar_t *Buyer_reference = jResp.stringOf(L"customer_snapshot.buyer_reference");
const wchar_t *Foreign_supplier_number = jResp.stringOf(L"customer_snapshot.foreign_supplier_number");
const wchar_t *discount = jResp.stringOf(L"discount");
const wchar_t *discount_type = jResp.stringOf(L"discount_type");
const wchar_t *document_date = jResp.stringOf(L"document_date");
const wchar_t *due_date = jResp.stringOf(L"due_date");
const wchar_t *edited_at = jResp.stringOf(L"edited_at");
const wchar_t *external_id = jResp.stringOf(L"external_id");
const wchar_t *replica_url = jResp.stringOf(L"replica_url");
const wchar_t *grace_period = jResp.stringOf(L"grace_period");
const wchar_t *due_in_days = jResp.stringOf(L"due_in_days");
const wchar_t *id = jResp.stringOf(L"id");
bool is_acceptable_on_public_domain = jResp.BoolOf(L"is_acceptable_on_public_domain");
bool is_archive = jResp.BoolOf(L"is_archive");
const wchar_t *is_draft = jResp.stringOf(L"is_draft");
bool is_replica = jResp.BoolOf(L"is_replica");
bool is_oss = jResp.BoolOf(L"is_oss");
const wchar_t *last_postbox_id = jResp.stringOf(L"last_postbox_id");
const wchar_t *login_id = jResp.stringOf(L"login_id");
const wchar_t *v_number = jResp.stringOf(L"number");
const wchar_t *order_number = jResp.stringOf(L"order_number");
const wchar_t *buyer_reference = jResp.stringOf(L"buyer_reference");
const wchar_t *paid_amount = jResp.stringOf(L"paid_amount");
const wchar_t *paid_at = jResp.stringOf(L"paid_at");
const wchar_t *pdf_pages = jResp.stringOf(L"pdf_pages");
const wchar_t *pdf_template = jResp.stringOf(L"pdf_template");
const wchar_t *project_id = jResp.stringOf(L"project_id");
const wchar_t *Next_date = jResp.stringOf(L"recurring_options.next_date");
const wchar_t *Frequency = jResp.stringOf(L"recurring_options.frequency");
const wchar_t *Frequency_special = jResp.stringOf(L"recurring_options.frequency_special");
int Interval = jResp.IntOf(L"recurring_options.interval");
const wchar_t *End_date_or_count = jResp.stringOf(L"recurring_options.end_date_or_count");
const wchar_t *Status = jResp.stringOf(L"recurring_options.status");
bool As_draft = jResp.BoolOf(L"recurring_options.as_draft");
bool Is_notify = jResp.BoolOf(L"recurring_options.is_notify");
const wchar_t *Send_as = jResp.stringOf(L"recurring_options.send_as");
bool Is_sign = jResp.BoolOf(L"recurring_options.is_sign");
bool Is_paid = jResp.BoolOf(L"recurring_options.is_paid");
const wchar_t *Paid_date_option = jResp.stringOf(L"recurring_options.paid_date_option");
bool Is_sepa = jResp.BoolOf(L"recurring_options.is_sepa");
const wchar_t *Sepa_local_instrument = jResp.stringOf(L"recurring_options.sepa_local_instrument");
const wchar_t *Sepa_sequence_type = jResp.stringOf(L"recurring_options.sepa_sequence_type");
const wchar_t *Sepa_reference = jResp.stringOf(L"recurring_options.sepa_reference");
const wchar_t *Sepa_remittance_information = jResp.stringOf(L"recurring_options.sepa_remittance_information");
const wchar_t *Target_type = jResp.stringOf(L"recurring_options.target_type");
const wchar_t *ref_id = jResp.stringOf(L"ref_id");
const wchar_t *root_id = jResp.stringOf(L"root_id");
const wchar_t *v_Type = jResp.stringOf(L"service_date.type");
const wchar_t *Date = jResp.stringOf(L"service_date.date");
jResp.DtOf(L"service_date.date_from",false,Date_from);
jResp.DtOf(L"service_date.date_to",false,Date_to);
const wchar_t *Text = jResp.stringOf(L"service_date.text");
const wchar_t *shipping_country = jResp.stringOf(L"shipping_country");
const wchar_t *status = jResp.stringOf(L"status");
const wchar_t *text = jResp.stringOf(L"text");
const wchar_t *text_prefix = jResp.stringOf(L"text_prefix");
const wchar_t *text_tax = jResp.stringOf(L"text_tax");
const wchar_t *title = jResp.stringOf(L"title");
const wchar_t *v_type = jResp.stringOf(L"type");
bool use_shipping_address = jResp.BoolOf(L"use_shipping_address");
const wchar_t *vat_country = jResp.stringOf(L"vat_country");
const wchar_t *vat_id = jResp.stringOf(L"vat_id");
const wchar_t *fulfillment_country = jResp.stringOf(L"fulfillment_country");
const wchar_t *vat_option = jResp.stringOf(L"vat_option");
int i = 0;
int count_i = jResp.SizeOfArray(L"attachment_ids");
while (i < count_i) {
jResp.put_I(i);
strVal = jResp.stringOf(L"attachment_ids[i]");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"customer_snapshot.additional_groups_ids");
while (i < count_i) {
jResp.put_I(i);
strVal = jResp.stringOf(L"customer_snapshot.additional_groups_ids[i]");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"customer_snapshot.emails");
while (i < count_i) {
jResp.put_I(i);
strVal = jResp.stringOf(L"customer_snapshot.emails[i]");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"item_notes");
while (i < count_i) {
jResp.put_I(i);
strVal = jResp.stringOf(L"item_notes[i]");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"items");
while (i < count_i) {
jResp.put_I(i);
v_number = jResp.stringOf(L"items[i].number");
description = jResp.stringOf(L"items[i].description");
document_note = jResp.stringOf(L"items[i].document_note");
quantity = jResp.IntOf(L"items[i].quantity");
quantity_str = jResp.stringOf(L"items[i].quantity_str");
unit = jResp.stringOf(L"items[i].unit");
v_type = jResp.stringOf(L"items[i].type");
position = jResp.stringOf(L"items[i].position");
single_price_net = jResp.stringOf(L"items[i].single_price_net");
single_price_gross = jResp.stringOf(L"items[i].single_price_gross");
vat_percent = jResp.IntOf(L"items[i].vat_percent");
discount = jResp.stringOf(L"items[i].discount");
discount_type = jResp.stringOf(L"items[i].discount_type");
position_id = jResp.stringOf(L"items[i].position_id");
total_price_net = jResp.stringOf(L"items[i].total_price_net");
total_price_gross = jResp.stringOf(L"items[i].total_price_gross");
total_vat = jResp.stringOf(L"items[i].total_vat");
serial_number_id = jResp.stringOf(L"items[i].serial_number_id");
serial_number = jResp.stringOf(L"items[i].serial_number");
booking_account = jResp.stringOf(L"items[i].booking_account");
export_cost_1 = jResp.stringOf(L"items[i].export_cost_1");
export_cost_2 = jResp.stringOf(L"items[i].export_cost_2");
cost_price_net = jResp.stringOf(L"items[i].cost_price_net");
cost_price_total = jResp.stringOf(L"items[i].cost_price_total");
cost_price_charge = jResp.stringOf(L"items[i].cost_price_charge");
cost_price_charge_type = jResp.stringOf(L"items[i].cost_price_charge_type");
itemType = jResp.stringOf(L"items[i].itemType");
id = jResp.stringOf(L"items[i].id");
i = i + 1;
}
i = 0;
count_i = jResp.SizeOfArray(L"file_format_config");
while (i < count_i) {
jResp.put_I(i);
v_type = jResp.stringOf(L"file_format_config[i].type");
i = i + 1;
}
}
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": ""
}
]
}