A common tool for testing REST services is the tool Postman.
This article will cover how to access and use the Uniconta ODATA API using Postman.
Because it is an ODATA API, no API key is required. Uniconta login credentials are the only thing you need to call the API.
You can find endpoints and more in the CRUD operations in ODATA article.
In general, the endpoints have the following formats:
You can filter or query for specific entries as follows:
The above will return a JSON array with 1 entry, which has Account 2001.
Authorization uses Basic Auth.
The username is where the company id is specified, as well as the username.
The company and username can be specified in the following format:
The two zeros at the start denotes that a company ID will be provided. There are more ways to login, see the article “OData – Hent data fra Uniconta” for more information.
Sending a PUT request
In order to update an entitiy, we must first get said entity.
We can do this by using the filtered search from earlier:
The JSON element within the array, we will copy to the body of our PUT request. It may look something like this:
Note that all properties with null will be omitted. So if the address2 property was null, you must add it yourself as so:
Then send out the PUT request, which should return status code 200.
Sending a DELETE request
Similarly to UPDATE, we must first get the entity to delete.
We simply dump the JSON element into the body of the DELETE request and sned it out.
Sending a POST request
When we wish to create a new entity, we simply need to provide the body of the request with a JSON of the information we wish to provide.
Only the entities required properties must be provided(e.g. Account).
A valid body for a CreditorClient may be the following:
“Name”: “My Test Account”