Accessing APIs without React

As of c863c77 , a valid JWT is needed to access API endpoints. If you don't want to use the normal route (React) there are a few options:

  • Programmatically through JS: See examples in Login.js, Admin.js, Search.js

  • Programmatically through Python: See /server/test_api.py

  • Using Postman

Using Postman

To use Postman:

  • Get a valid JWT, which is returned by /api/user/login

    • You can do this through Postman or by capturing the returned access_tokenvalue using browser devtools

Postman_login
  • Tell Postman to use that value for API calls

    • Copy the value

    • Edit the collection (three dots when hovering to right of collection name, Edit)

Postman_view_more
  • Choose Authorization, Type: Bearer Token

  • Paste value into the Token field, save

Postman_token

Start issuing API calls

Error codes

401 - Bad login credentials 403 - Tried to access an Admin endpoint with user-level credentials 422 - JWT value was corrupted/failed validation

Last updated