Chilkat Online Tools

Objective-C / easybill REST API / Fetch document

Back to Collection Items

#import <CkoHttp.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>
#import <CkoDtObj.h>
#import <NSString.h>

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

CkoHttp *http = [[CkoHttp alloc] init];
BOOL success;

[http SetRequestHeader: @"Authorization" value: @"{{apiKey}}"];
[http SetRequestHeader: @"Accept" value: @"application/json"];

CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
success = [http QuickGetSb: @"https://api.easybill.de/rest/v1/documents/:id" sbContent: sbResponseBody];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

CkoJsonObject *jResp = [[CkoJsonObject alloc] init];
[jResp LoadSb: sbResponseBody];
jResp.EmitCompact = NO;

NSLog(@"%@",@"Response Body:");
NSLog(@"%@",[jResp Emit]);

int respStatusCode = [http.LastStatus intValue];
NSLog(@"%@%d",@"Response Status Code = ",respStatusCode);
if (respStatusCode >= 400) {
    NSLog(@"%@",@"Response Header:");
    NSLog(@"%@",http.LastHeader);
    NSLog(@"%@",@"Failed.");
    return;
}

// 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

CkoDtObj *Date_from = [[CkoDtObj alloc] init];
CkoDtObj *Date_to = [[CkoDtObj alloc] init];
NSString *strVal = 0;
NSString *description = 0;
NSString *document_note = 0;
int quantity;
NSString *quantity_str = 0;
NSString *unit = 0;
NSString *position = 0;
NSString *single_price_net = 0;
NSString *single_price_gross = 0;
int vat_percent;
NSString *position_id = 0;
NSString *total_price_net = 0;
NSString *total_price_gross = 0;
NSString *total_vat = 0;
NSString *serial_number_id = 0;
NSString *serial_number = 0;
NSString *booking_account = 0;
NSString *export_cost_1 = 0;
NSString *export_cost_2 = 0;
NSString *cost_price_net = 0;
NSString *cost_price_total = 0;
NSString *cost_price_charge = 0;
NSString *cost_price_charge_type = 0;
NSString *itemType = 0;

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

i = 0;
count_i = [[jResp SizeOfArray: @"customer_snapshot.additional_groups_ids"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    strVal = [jResp StringOf: @"customer_snapshot.additional_groups_ids[i]"];
    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"customer_snapshot.emails"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    strVal = [jResp StringOf: @"customer_snapshot.emails[i]"];
    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"item_notes"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    strVal = [jResp StringOf: @"item_notes[i]"];
    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"items"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    v_number = [jResp StringOf: @"items[i].number"];
    description = [jResp StringOf: @"items[i].description"];
    document_note = [jResp StringOf: @"items[i].document_note"];
    quantity = [[jResp IntOf: @"items[i].quantity"] intValue];
    quantity_str = [jResp StringOf: @"items[i].quantity_str"];
    unit = [jResp StringOf: @"items[i].unit"];
    v_type = [jResp StringOf: @"items[i].type"];
    position = [jResp StringOf: @"items[i].position"];
    single_price_net = [jResp StringOf: @"items[i].single_price_net"];
    single_price_gross = [jResp StringOf: @"items[i].single_price_gross"];
    vat_percent = [[jResp IntOf: @"items[i].vat_percent"] intValue];
    discount = [jResp StringOf: @"items[i].discount"];
    discount_type = [jResp StringOf: @"items[i].discount_type"];
    position_id = [jResp StringOf: @"items[i].position_id"];
    total_price_net = [jResp StringOf: @"items[i].total_price_net"];
    total_price_gross = [jResp StringOf: @"items[i].total_price_gross"];
    total_vat = [jResp StringOf: @"items[i].total_vat"];
    serial_number_id = [jResp StringOf: @"items[i].serial_number_id"];
    serial_number = [jResp StringOf: @"items[i].serial_number"];
    booking_account = [jResp StringOf: @"items[i].booking_account"];
    export_cost_1 = [jResp StringOf: @"items[i].export_cost_1"];
    export_cost_2 = [jResp StringOf: @"items[i].export_cost_2"];
    cost_price_net = [jResp StringOf: @"items[i].cost_price_net"];
    cost_price_total = [jResp StringOf: @"items[i].cost_price_total"];
    cost_price_charge = [jResp StringOf: @"items[i].cost_price_charge"];
    cost_price_charge_type = [jResp StringOf: @"items[i].cost_price_charge_type"];
    itemType = [jResp StringOf: @"items[i].itemType"];
    id = [jResp StringOf: @"items[i].id"];
    i = i + 1;
}

i = 0;
count_i = [[jResp SizeOfArray: @"file_format_config"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    v_type = [jResp StringOf: @"file_format_config[i].type"];
    i = i + 1;
}

Curl Command

curl -X GET
	-H "Authorization: {{apiKey}}"
	-H "Accept: application/json"
https://api.easybill.de/rest/v1/documents/:id

Postman Collection Item JSON

{
  "name": "Fetch document",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/documents/:id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "documents",
        ":id"
      ],
      "variable": [
        {
          "key": "id",
          "value": "<long>",
          "description": "(Required) ID of document"
        }
      ]
    }
  },
  "response": [
    {
      "name": "Successful operation",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id"
          ],
          "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": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Too Many Requests",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}