Skip to main content

PHP Retrieving Data from ABRA Flexi

How to Connect to ABRA Flexi from a PHP Application

Written by Lenka Haringerová

This article describes the simplest way to connect a PHP application to the ABRA Flexi system using the REST API in order to retrieve data from a third-party record.

First steps

  1. Create a dedicated user for the API connection. For this user, it is sufficient to set the User Type to REST-API. This means the user will not be able to log in via the desktop client or the web interface.
    The user's role depends solely on which records the user should have access to. For example, a user created for integration with an e-shop certainly does not need to be an ADMIN. The USER role will be more than sufficient.

  2. The license must support REST-API. Currently, REST-API read access is included in every ABRA Flexi license (User Type: Read Only). If you need to write data to the system, a license with REST-API write access will be required (User Type: REST API). This module is an add-on, but the automation it enables will many times over outweigh the initial investment.

  3. Find out the company identifier and the address and port of the server you will be connecting to.
    The server address and port can be found in the desktop application under data source management, or after connecting to a company in the About Flexi dialog (Help – About Flexi), on the Application Details tab, in the Central Server Address field (it will contain an expression similar to, for example, demo.flexibee.eu:5434).
    The company identifier can only be found via the web interface. At the address server:port/c (e.g. demo.flexibee.eu/c), you can list the companies accessible to the user in Flexi. Clicking on any of them will connect you to that company and the URL will change to server:port/c/identifier (e.g. demo.flexibee.eu/c/demo). The identifier is therefore the end of the URL after the last slash (in the demo example, this is demo).

Programming

The program below connects to the server demo.flexibee.eu. Using HTTP authentication, it logs in as user winstrom with the password winstrom, into the company with the identifier demo. It downloads an XML file of the address book from this company and displays it as a table, with the company abbreviation in the first column and the company name in the second column.

If an error occurs during loading, it will display the error "An error occurred during the operation" and the error code.

<?xml version="1.0"?>
Did this answer your question?