Companies ========= Companies are accessible under the ``https://*.recras.nl/api2/bedrijven`` 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`` permission. :resheader Location: The URI of the newly created resource. :json string bedrijfsnaam: The internal company name :json string weergavenaam: The company name as communicated to customers. Will take the value of ``bedrijfsnaam`` if empty. :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)`_ :json integer factuur_pdf_template_id: **Required.** The ID of a PDF template with the ``invoice`` context. :json string onderwerp_mail_eindfactuur: **Required.** The default subject line for invoice emails. :json string body_mail_eindfactuur: **Required.** The default body for invoice emails. :json string onderwerp_eerste_betalingsherinnering: **Required.** The subject line for the first invoice reminder. :json string body_eerste_betalingsherinnering: **Required.** The body for the first invoice reminder. :json string onderwerp_tweede_betalingsherinnering: **Required.** The subject line for the second invoice reminder. :json string body_tweede_betalingsherinnering: **Required.** The body for the second invoice reminder. :json string onderwerp_betaalbevestiging: **Required.** The subject line for the payment confirmation. :json string body_betaalbevestiging: **Required.** The body for the 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)", "weergavenaam": "Company name (as communicated to customers)", "slogan": "Company's slogan", "adres": null, "postcode": null, "plaats": null, "landcode": null, "iban": null, "bic": null, "bank_tnv": null, "btw_nummer": null, "kvk_nummer": null, "factuur_betaaltermijn": 30, "website": null, "telefoon": null, "soort_klanten": [], "free_relation_fields": [], "email": "company@example.com", "smtp_integration_id": null, "ondertekening_standaardmails": null, "programmarender_aantallen": false, "default_font": "Arial", "factureren_na_dagen": 0, "factuur_pdf_template_id": 3, "kassa_factuur_pdf_template_id": null, "online_boeking_factuur_pdf_template_id": null, "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", "locale": "nl_NL", "standaard_aanhef": "Beste {contactpersoon_aanspreeknaam}", "attentietekst": "t.a.v.", "standaard_titel_man": "meneer", "standaard_titel_vrouw": "mevrouw", "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`` 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``, 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.