Companies ========= Companies are accessible under the ``https://*.recras.nl/api2/bedrijven`` (companies) namespace. Create ------ .. http:post:: /api2/bedrijven Create a company **Example request** .. sourcecode:: http POST /api2/bedrijven HTTP/1.1 Host: demo.recras.nl Accept: application/json { "bedrijfsnaam": "Company name (internal)", "weergavenaam": "Company name (as communicated to customers)", "slogan": "Company's slogan", "email": "company@example.com", "factuur_pdf_template_id": 3, "onderwerp_mail_eindfactuur": "Final invoice email subject", "body_mail_eindfactuur": "Final invoice email body", "onderwerp_eerste_betalingsherinnering": "First payment reminder email subject", "body_eerste_betalingsherinnering": "First payment reminder email body", "onderwerp_tweede_betalingsherinnering": "Second payment reminder email subject", "body_tweede_betalingsherinnering": "Second payment reminder email body", "onderwerp_betaalbevestiging": "Payment confirmation email subject", "body_betaalbevestiging": "Payment confirmation email body", "factuur_betaaltermijn": 30 } :statuscode 201: Resource created :statuscode 403: Authenticated user lacks the ``editBedrijfsgegevens`` (editCompanyDetails) permission. :resheader Location: The URI of the newly created resource. :json string bedrijfsnaam: The internal company name (`bedrijfsnaam` means company_name) :json string weergavenaam: The company name as communicated to customers. Will take the value of ``bedrijfsnaam`` (company_name) if empty. (`weergavenaam` means display_name) :json string slogan: The company slogan :json email email: **Required.** The envelope address for emails sent from this company :json integer factuur_betaaltermijn: The default number of days to set the payment deadline for invoices. *Must be ≥ 0*, see `v1.0.1 (2020-06)`_ (`factuur_betaaltermijn` means invoice_payment_term) :json integer factuur_pdf_template_id: **Required.** The ID of a PDF template with the ``invoice`` context. (`factuur_pdf_template_id` means invoice_pdf_template_id) :json string onderwerp_mail_eindfactuur: **Required.** The default subject line for invoice emails. (`onderwerp_mail_eindfactuur` means subject_email_final_invoice) :json string body_mail_eindfactuur: **Required.** The default body for invoice emails. (`body_mail_eindfactuur` means body_email_final_invoice) :json string onderwerp_eerste_betalingsherinnering: **Required.** The subject line for the first invoice reminder. (`onderwerp_eerste_betalingsherinnering` means subject_first_payment_reminder) :json string body_eerste_betalingsherinnering: **Required.** The body for the first invoice reminder. (`body_eerste_betalingsherinnering` means body_first_payment_reminder) :json string onderwerp_tweede_betalingsherinnering: **Required.** The subject line for the second invoice reminder. (`onderwerp_tweede_betalingsherinnering` means subject_second_payment_reminder) :json string body_tweede_betalingsherinnering: **Required.** The body for the second invoice reminder. (`body_tweede_betalingsherinnering` means body_second_payment_reminder) :json string onderwerp_betaalbevestiging: **Required.** The subject line for the payment confirmation. (`onderwerp_betaalbevestiging` means subject_payment_confirmation) :json string body_betaalbevestiging: **Required.** The body for the payment confirmation. (`body_betaalbevestiging` means body_payment_confirmation) :json mixed other_fields: This documentation is incomplete, please contact the Recras development team if you have specific questions regarding this API. **Example response** .. sourcecode:: http HTTP/1.1 201 Created Content-Type: application/json { "id": 8, "bedrijfsnaam": "Company name (internal)", // (company_name) "weergavenaam": "Company name (as communicated to customers)", // (display_name) "slogan": "Company's slogan", "adres": null, // (address) "postcode": null, // (postal_code) "plaats": null, // (city) "landcode": null, // (country_code) "iban": null, "bic": null, "bank_tnv": null, // (bank_account_holder) "btw_nummer": null, // (vat_number) "kvk_nummer": null, // (chamber_of_commerce_number) "factuur_betaaltermijn": 30, // (invoice_payment_term) "website": null, "telefoon": null, // (phone) "soort_klanten": [], // (customer_types) "free_relation_fields": [], "email": "company@example.com", "smtp_integration_id": null, "ondertekening_standaardmails": null, // (signature_standard_emails) "programmarender_aantallen": false, // (program_render_quantities) "default_font": "Arial", "factureren_na_dagen": 0, // (invoice_after_days) "factuur_pdf_template_id": 3, // (invoice_pdf_template_id) "kassa_factuur_pdf_template_id": null, // (pos_invoice_pdf_template_id) "online_boeking_factuur_pdf_template_id": null, // (online_booking_invoice_pdf_template_id) "onderwerp_mail_eindfactuur": "Final invoice email subject", // (subject_email_final_invoice) "body_mail_eindfactuur": "Final invoice email body", // (body_email_final_invoice) "onderwerp_eerste_betalingsherinnering": "First payment reminder email subject", // (subject_first_payment_reminder) "body_eerste_betalingsherinnering": "First payment reminder email body", // (body_first_payment_reminder) "onderwerp_tweede_betalingsherinnering": "Second payment reminder email subject", // (subject_second_payment_reminder) "body_tweede_betalingsherinnering": "Second payment reminder email body", // (body_second_payment_reminder) "onderwerp_betaalbevestiging": "Payment confirmation email subject", // (subject_payment_confirmation) "body_betaalbevestiging": "Payment confirmation email body", // (body_payment_confirmation) "locale": "nl_NL", "standaard_aanhef": "Beste {contactpersoon_aanspreeknaam}", // (default_salutation: "Dear {contact_person_salutation_name}") "attentietekst": "t.a.v.", // (attention_text: "attn.") "standaard_titel_man": "meneer", // (default_title_male: "mr") "standaard_titel_vrouw": "mevrouw", // (default_title_female: "mrs/ms") "latitude": null, "longitude": null, "communication_default_mail_subject": "", "mollie_api_key": "", "deleted_at": null, "logo_href": null, "is_deletable": true, "_links": { "meta": { "delete_reasons": [] } } } Read ---- .. http:get:: /api2/bedrijven Retrieve a list of companies :query boolean is_deleted: *Default: empty*. With a true value, previously deleted companies will be included in the result. :statuscode 200: OK :statuscode 406: Error in a query parameter, expect the response to be a list of error objects. .. http:get:: /api2/bedrijven/(int:id) Retrieve a single company resource. :statuscode 200: OK :statuscode 406: Error in a query parameter, expect the response to be a list of error objects. :json boolean is_deletable: Wether this resource can be deleted. See :http:delete:`/api2/bedrijven/(int:id)`. Update ------ .. http:put:: /api2/bedrijven/(int:id) The companies-endpoint supports PUT-back semantics: please retrieve a resource, update some values and send everything back. Partial updates may work but are not supported. :statuscode 200: OK :statuscode 403: Authenticated user lacks the ``editBedrijfsgegevens`` (editCompanyDetails) permission :statuscode 406: Error in the payload, expect the response to be a list of error objects. Delete ------ .. http:delete:: /api2/bedrijven/(int:id) This resource has soft-delete semantics: deleting it does not remove it from the database, but archives it and makes it invisible. This endpoint is only available for resources with the ``is_deletable`` flag set to ``true``. See :http:get:`/api2/bedrijven/(int:id)`. :statuscode 200: OK :statuscode 500: The resource is not deletable, or another error occured. Version history --------------- v1.0.1 (2020-06) ~~~~~~~~~~~~~~~~ Fixed ``factuur_betaaltermijn`` (invoice_payment_term), which used to accept negative values. This would trigger errors in calculating the payment deadline of invoices, thus failing to render the invoice. v1.0.0 ~~~~~~ Original version, released way in the past.