...
Warning |
---|
The username/password authentication described below will eventually be is being deprecated in favor of Api Keys. Api Keys will be released in the first half of Q1 2022. |
Overview
The Flex5 REST API is in an early access stage and under heavy development & evolution. This is our "private" API that is being built to service our Flex5 Phone, Tablet, & Desktop applications.
...
We envision a more public-friendly API in the future that allows external developers to better fetch & aggregate data in a single request.
API Terms & Conditions
Since this API is under heavy development & evolution (and could get replaced with a "public" API someday), we require that you sign off on an API Terms & Conditions document; you can find it here.
Download that document, fill it in, sign it, then go here to complete a request form. Once the request is received, we will review it, and if approved, we will provide you with a special "source" property which is needed to get authentication tokens.
Accessing Your Own API Documentation
Our API Documentation tool is Swagger UI. You can browse your own Swagger UI by using the template URL below.
...
You can download the entire Swagger API definition by right-clicking the link below API Documentation (near the top of the screen) and using your browser's "Save As" feature. The link should look like https://yourflexsite.flexrentalsolutions.com/f5/api/api-docs.
An Authentication Example With The Flex5 Dev API
You can browse the cutting edge API's from Flex Dev here: https://flex5dev.flexrentalsolutions.com/f5/swagger-ui.html
...
Note: you will need to repeat this process for your own URL. Also, note that your Flex site will only show the currently available public APIs which will differ from the flex5dev offerings.
Writing Your Own Code
When you write your code against the API, the process will be similar. You'll have to post to the authentication endpoint to get a token and then send it down in the X-Auth-Token header for ALL requests.
If your token has aged approximately 1 hour, the server will kick out a refresh token in the X-Auth-Token-Refreshed header. Our app just sniffs for the refresh token on each request, and if it finds one, it replaces the current one and starts sending the new one.
Tip |
---|
A Flex Api token lasts approximately 12 hours and then expires. You should cache the token somewhere safe and sniff for a new token on every request. Replace the existing token when you see a new one. If you had a long period between requests and your token has expired, you'll get a 401 UNAUTHORIZED. You can detect that, and send a new /auth request to get a new token. |
Understanding Flex5 API
You will not be able to fully comprehend the Flex5 API only using the Swagger UI. Since the Flex5 UI uses the Flex5 API, you can use your browser's network tool to observe which APIs are being used, query parameters passed to the API, and JSON data being sent and received to and from the API.
...