Skip to content
English
  • There are no suggestions because the search field is empty.

Fetch internal accounts from your API (JSON)

Instead of importing projects and other internal accounts, Expense can fetch them directly from your own API. Then a new project shows in Expense as soon as it has been created in your system.

๐Ÿ”„ How it works

You publish your internal accounts, for example projects, through a REST API that responds with JSON. When a user chooses a project when doing the accounting, Expense fetches the list from your API, and can send along what the user searches for.

API (JSON) Import with XML or Custom import
How data reaches Expense Expense asks your API at every search You send a file according to a schema
How fast new values show Right away At the next import
What can be fetched Internal accounts, for example projects Persons, roles, accounts and more
Who builds what You build the API, Expense Support turns on the feature You create the file, Expense receives it

๐Ÿ‘‰ Applies to: administrators and developers who want to connect Expense to their own register of internal accounts.

โœ… Before you start

  1. Contact Expense Support, who turn on support for external API.
  2. Build an API that returns a list in JSON with one field for the code and one field for the description.
  3. If users should be able to search, make sure the API accepts a search string in the URL and filters the result.

โš™๏ธ Settings in Expense

Go to Administrate > Internal accounts, open the internal account, for example Project, and choose External API as input type. Then fill in:

Setting What you fill in Example
API Url The address of your API. The variable <%search%> is replaced with what the user searches for https://examplecustomer.com/project?s=<%search%>
Envelope The name of the list if the response is in an envelope. Otherwise leave it empty projects
Param for code The name of the field with the code projectCode
Param for description The name of the field with the description description

๐Ÿงพ Example responses

Always state the character encoding in the header. Without charset, the response is read as ISO-8859-1.

Content-Type: application/json; charset=utf-8

Without envelope

[   {"projectCode": "1234", "description": "Example project"},   {"projectCode": "6789", "description": "Another project"} ]

With envelope

{   "projects": [     {"projectCode": "1234", "description": "Example project"},     {"projectCode": "6789", "description": "Another project"}   ] }

๐Ÿ” Security

Expense does not support session-based login to your API. We recommend that the API:

  • ๐Ÿ”’ Uses HTTPS
  • ๐ŸŒ Only accepts calls from Expense's IP address
  • ๐Ÿ”‘ Requires a token in the URL

โ“ Frequently asked questions (FAQ)

Can we fetch users through the API?
No, the API connection is for internal accounts such as projects. You import users with an XML file, Custom import or the Pyramid format.

Does the API have to support search?
No, but without search the whole list shows. With the variable <%search%>, the user can search among the values.

What happens if our API does not respond?
Then the user cannot choose values for the internal account. Make sure the API is available.

Where do we get Expense's IP address?
Contact Expense Support.

โœ… Summary

  • ๐Ÿ”„ Expense fetches internal accounts directly from your API
  • โš™๏ธ Set API Url, envelope and field names under Administrate > Internal accounts
  • ๐Ÿงพ The API responds with a JSON list with code and description
  • ๐Ÿ” Use HTTPS, IP restriction and a token

๐Ÿ”— Related articles