Skip to main content

Updating companies from ARES via API

How to perform "Update All" and "Update from Internet" via API?

Written by Petr Pech

Both the desktop application and the web interface include a service that updates a company's details in the address book from ARES. The function in the REST API behaves the same way as in the desktop app — it updates the VAT ID and bank account, but does not update the company's address or create new companies.


Building the URL

The service is available at /adresar/aktualizovat-vse and is called using the GET method:

GET https://demo.flexibee.eu/c/demo/adresar/aktualizovat-vse.json

The call can be narrowed down using a filter in parentheses:

GET https://demo.flexibee.eu/c/demo/adresar/(id eq 720)/aktualizovat-vse.json
GET https://demo.flexibee.eu/c/demo/adresar/(kod = 'ABRA')/aktualizovat-vse.json

⚠️ Using any HTTP method other than GET returns 405 Method Not Allowed.


Usage examples

Update all

Calling the service without a filter is equivalent to the user service Update all and updates the entire address book as recorded in ABRA Flexi.

GET https://demo.flexibee.eu/c/demo/adresar/aktualizovat-vse.json

🚨 Without a filter, the service goes through the entire address book, so it takes a long time on larger databases and changes many companies at once. In production, run it with a filter or outside business hours.

Update a specific company

Calling the service with a filter is equivalent to the user service Update from internet — it updates only the filtered address book records, again their VAT ID and bank account. The company's address is not changed.

GET https://demo.flexibee.eu/c/demo/adresar/(kod = 'ABRA')/aktualizovat-vse.json


Output

The output contains standard return values with the number of changed records and their IDs:

{
"winstrom": {
"@version": "1.0",
"success": "true",
"stats": {
"created": "0",
"updated": "2",
"deleted": "0",
"skipped": "0",
"failed": "0"
},
"results": [
{ "id": "813" },
{ "id": "807" }
]
}
}

A filter that finds no company also returns 200 and success true, but with updated equal to zero and an empty results. Therefore, always read the actual number of updates from updated.


Related

Did this answer your question?