# API system services

LIBSAFE has an API to exchange information with other systems or ad-hoc developments by the user. This functionality makes it possible to automate the flow of data between systems without user intervention. Each system user has a profile with different permission levels and it allows accessing to certain requested data. The API validates the availability of the data according to the user’s profile through a unique token, previously assigned by the platform, and, depending on the user owner of the token and the level of permissions, then it provides de requested data.

There are a wide variety of _end-points_ or query methods for obtaining related information with preserved objects such as: the objects’ list, the files within an object, the list of retrieval jobs of the objects or with higher detail level, such as the metadata of one object. All of these is possible to be obtained in such a structured format as JSON (JavaScript Object Notation). This format allows converting information from strings into structured objects or representations. The API is available in versions depending on access methods. On new releases the number of methods to provide more data has increased. Currently, the API has two versions (v2 and v3) this last being an extension of the previous and adds more end-points.

LIBSAFE’s web interface visualizes the access token and the technical documentation link of the API. This information is displayed in the user profile window where the token is found and the access to documentation implemented in _apidoc_ format.

![](https://2476985709-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkhEUvHaUAQ7Cu_eShA%2F-MkmchgZSTF-wAJKocXm%2F-MkmctlORn5GeCGxrL4C%2Fimage.png?alt=media\&token=31f857ca-85a3-4018-92ad-670fffaf86ea)

From the API documentation (_apidoc_) it is possible to use the token to make simple requests and to visualize all the details to make the request from the query environment. From each _apidoc_ section, the interface shows all necessary parameters such as filters or conditions to include in the request, as well as the possible response structures with the corresponding http codes in the REST standard.

![](https://2476985709-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkhEUvHaUAQ7Cu_eShA%2F-MkmchgZSTF-wAJKocXm%2F-MkmcxGPWdlzo2MkwePC%2Fimage.png?alt=media\&token=c02bd147-ac9d-4252-a46f-c4ddf785ffa9)

The _apidoc_ documentation is available in two languages (Spanish and English), that are automatically configured based on the user’s language profile defined in LIBSAFE.

**How to use the API**

In order to consume the resources offered by the API, it is only necessary to know the token that identifies the user and to know the URL’s of the end-points of the API.

It is possible to obtain the user token through user profile in LIBSAFE, this data must be used from the main _apidoc_ window, indicating to the system which is the user test profile and the associated permissions; by clicking in the **Authorize** button a dialogue box appears to indicate the token and after inserting it, it is possible to consume API resources; it is possible to define the token using one of each section of _apidoc_ in the lock icon located in the right position of the main end-point; this lock icon redirects to the same window.

![](https://2476985709-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkhEUvHaUAQ7Cu_eShA%2F-MkmchgZSTF-wAJKocXm%2F-Mkmd05xepP0B4g1j9q_%2Fimage.png?alt=media\&token=66ed0c11-a1a3-4b65-bb03-1307ff33de02)

The URLs of the end-points can be accessed from the summary of each service presented in the apidoc technical documentation. This path is defined according to the LIBSAFE URL since the API is a subdomain of the LIBSAFE URL; so if the LIBSAFE URL is [https://libsafe.com](https://libsafe.com) the API, depending on the version to be used, can be [https://libsafe.com/api/v3](https://libsafe.com/api/v3) + end-point to be consumed.

The end-point to consume is indicated in the name of each one, e.g. to get the list of audit jobs, the end-point to use is /auditjobs and the full URL will be:

[https://libsafe.com/api/v3/auditjobs](https://libsafe.com/api/v3/auditjobs)

![](https://2476985709-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkhEUvHaUAQ7Cu_eShA%2F-MkmchgZSTF-wAJKocXm%2F-Mkmd4BQxv9_xQV0s-jz%2Fimage.png?alt=media\&token=aeb956d2-ed7e-425a-8217-62902ea8e100)

By clicking over _apidoc_ section it is possible to execute some end-point and get immediate results; this mechanism is very useful to confirm the availability of the API, the response data format and the own HTTP request data as well as the technical data of the REST API. By executing this process the expected result contains: used URL, HTTP code or JSON response of the request.

![](https://2476985709-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkhEUvHaUAQ7Cu_eShA%2F-MkmchgZSTF-wAJKocXm%2F-Mkmd6vwtOE8zrIL1Yj_%2Fimage.png?alt=media\&token=2e090b1c-727d-4a21-a602-642f3f44ec45)

By clicking “Try it out” (important to indicate the token previously) y defining request parameters values (optional and depending of required needs or available)

![](https://2476985709-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkhEUvHaUAQ7Cu_eShA%2F-MkmchgZSTF-wAJKocXm%2F-MkmdCfizTwb3Sa_hnSz%2Fimage.png?alt=media\&token=8da1c54b-c434-4f8d-ac4a-250dee377dcb)

Finally clicking on “Execute” button

![](https://2476985709-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkhEUvHaUAQ7Cu_eShA%2F-MkmchgZSTF-wAJKocXm%2F-MkmdGuTybNv6Bb8pKYX%2Fimage.png?alt=media\&token=5ceedf13-8401-4fc7-a982-6d8fc289532c)

it is possible to obtain all consumed content from the _end-point_.

In order to be useful for developing external applications that can consume LIBSAFE’s API resources, with the result parameter: **Request URL** in which the entire URL of the _end-point_ is indicated, together with the HTTP verb (_get_, _post_, _put_ or _delete_), the parameters and the authorization token, all of this configured in a cURL request, the content found in the **Response body** section is obtained.
