Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: massaged process.

...

You can browse the cutting edge API's from Flex Dev here: https://flex5dev.flexrentalsolutions.com/f5/swagger-ui.html

First, Letlet's Get get an Auth Token By Going Here: https://flex5dev.flexrentalsolutions.com/f5/swagger-ui.html#/Authentication/authenticationRequestUsingPOSTPost a JSON body something like below (substitute in your username/password). by going to the above URL, then click Authentication and Try It Out. Replace the Example Value information (username/password/source) with that which you receive in response to sending the signed terms & conditions document.

The JSON should look something like the below. Notice the special "source" property, that is a special "key" that prevents unauthorized access to the Api. You will be provided this key in response to receiving the signed terms & conditions document.API.


Code Block
languagejs
{
  "username": "api-test",
  "password": "password",
  "source": "<will be provided>"
}


Next, click the Execute button. This will return a JSON response that looks something like below. Notice the "token" property. That is your authentication token. Copy that token and save it in a safe place.


Code Block
languagejs
{
  "token": "eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAOVWTY_TMBD9LzkXq7vqUtobEhcOiL3ABXFw7WkyrGMHj5NuF_HfmaQfcbdOGsSRQxXVHr95fm9mkl8Z1ZtsnckK3wSgkM0y5UEG0Nn67mFxt1yuFvPVYjmfZQGstOEjb2RbA88PGhqOrsCXSITOUrb-1v0VlXc_QAUSDcLuGCO2yMcVSkPCg5JGXRwWaBuwwfl9fOi4p5wHURP497pEewJU_CullTkMIUUpYybtQQ0Gwumg2OCLq4h5o0KbJxj0mPBcOR_AX-63a9J0D8a9oHkWQztl63IDXrgGvEcNCWlSF1IlsQSW9Q9fmdnr3D23UqLtXFIp6LFbDTE4KYMlr1EsoIzueA3nvAJBRavKsD2jHoDGEOcjsIQBGxiqD1VIm8OjJNo5rxP3TyLEATLPPeQyMGQK_-DAp06etP1G7l194X7CooS_LTztKZb0JIfyTJm7JS3FjWoZ48or5Kw0-BJfuMMfELh0ujZwiRnLFzt2LnpmssX8ajmKvZJIudpeNVi_nXtXVzcan5QcdGDj3Y5AFKg1DAYdikn8rHnisdTn0k8MKx9qlrPNyMZ47K06Oti7RSC9KkRwT7yU7rOh4Lhi-4ES9884M2nMgDXdw6AKPJXJGZ5M0-7KiGK4zKXWwiYocyWD1dLf8C-RiRtrvKfETnooHL8m2nRlFShZwxs08Ij2c9VW_dms65gP0GA_Rtu24LHytDVux0KVPMEF8Lg19BfNFSeRdSiYPrc2v2q_UN9Q_1wI0w2eaMuQKFN0nSzctHfHyKD_f3T7Psv4I-Twefbu_v7tfPX7D4ARUHjGCQAA.tgbY7Wsje-qyiP99xfXSGtJ3-3JBOhpJUGnSRbwcsshrOIwbrEy7LcoQ7NSI4INxhyWo6hV6V3KzXyYE6uniqA",
  "user": {
    "id": "3820fee0-5fa1-11e8-bc43-12aef1b28bdc",
    "name": "Api Test",
    "userName": "api-test",
    "emailAddress": "api-test@flexrentalsolutions.com"
  }
}


In Swagger, there is an AUTHORIZE an Authorize button in the top right. Copy the token property,  and paste your generated token there. Click Authorize, and now you click the Authorize button, paste it in the Value field and click the next Authorize button. Now you are logged in and can begin to play around with the other endpoints inside Swagger UI.

Note: you will need to repeat this process for your own URL.


Writing Your Own Code

When you write your code against the API, the process will be similar'ish. You'll have to post to the auth endpoint to get a token and then send it down in the X-Auth-Token header for ALL requests.

If you're token is close to expiring 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 just replaces the current one and starts sending the new one.

Good luck!