Skip to end of banner
Go to start of banner

How to use the API

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

The following provides info about how to use the V2 API. Basically there are always 2 steps involved:

  • make a request to logging in

  • make subsequent requests using the token returned by the log in request

For more info about how to use filters and so on, refer to the API documentation for details.

API Documentation

Note: SwaggerHub may have small problems, so if the page doesn’t display AFTER redirecting, just do an F5 refresh (sometimes you need to refresh a few times)

Authentication

We have 2 ways of authentication:

  • Logging in: (basic authentication) - This is to supply the username and the password to log in and get a token

  • Using the api: (bearer authentication) - This is to use a token when making any other requests, so that the system knows who is making the request

Step 1: Logging in:

You can use swagger hub to create an example to show how to log in

  • go to the /token POST endpoint

  • click the lock on the side to open a log in panel

  • enter username and password, hit the authorize button (you don’t have to use your real password here)

  • then expand the endpoint

  • hit Try it out, and execute

  • you get an example to show how to use this API endpoint,

    • including: e.g. 1) the POST method, 2) the URL to use, 3) headers and the most important one is the Authorisation header, with the keyword “Basic” and the base64 encoded username password pair

    • format before encoding: the format before encoding is the username and the password joined by a single colon, which is username:password

    • we support both encoded or clear text here, so both “Basic encoded_pair“ and “Basic username:password“ work

    • here is an example to show additional data you can supply for this request

Refer to the schema section for mandatory or optional data to supply in the request body, these are all optional for authentication.

Step 2: Using the API

You need to supply the token returned by the authentication in order to use the API for e.g. get a category.

To log in:

  • go to e.g. the category endpoint

  • click the lock on the side

  • fill in the token, and this time it’s the token returned by the /token request, not the base64 encoded username password pair

  • again, expand the drop down, click ‘Try it out’ and then ‘Execute’

  • you get an example of how to make such a request

  • in my case, I entered “hello” as the authentication token, just to show how the token is present on the header, in a valid case, the word “hello“ would be a long encoded text

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.