Write Data

Write Data

Data is written using the HTTP methods POST, PUT and DELETE.
The default format is XML. Each request should be written in the header “Content-type: application/xml” Please include the actual data and neatly wrapped in XML tags contained in the body:

curl -v -X POST
-H 'X-BillomatApiKey: {apischluessel}'
-H 'Content-Type: application/xml'
-d '<client><name>Musterfirma</name></client>'
https://{billomatid}.billomat.net/api/clients

JSON can also be used instead of XML when the content is sent as “Content-Type: application/json”:

curl -v -X POST
-H 'X-BillomatApiKey: {apischluessel}'
-H 'Content-Type: application/json'
-d '{"client":{"name":"Sample Company"}}'
https://{billomatid}.billomat.net/api/clients

This creates a new resource using POST – in this examples a new customer with the name ‘Sample Company’.
The answer comes with the status 201 Created and the request body with the entire object.
An already existing resource is modified with the PUT method:

curl -v -X PUT
-H 'X-BillomatApiKey: {apischluessel}'
-H 'Content-Type: application/xml'
-d '<client><name>Musterkunde</name></client>'
https://{billomatid}.billomat.net/api/clients/1

Was the treatment successful, status 200 OK is returned.
Deleting works very similar with the DELETE method, but without additional parameters in the request body:

curl -v -X DELETE
-H 'X-BillomatApiKey: {apischluessel}'
https://{billomatid}.billomat.net/api/clients/1

Here too, the status 200 OK is returned after a successful deletion.