Using Postman to query the backend - DSGT-DLP/Deep-Learning-Playground GitHub Wiki

To send requests to the backend without initiating from the frontend, whether it is to test what requests are received or to experiment with HTTP payloads, we can use the Postman agent.

Important: download the Postman desktop application. The web app will not be able to query localhost

How to get bearer token

All requests to the backend are authenticated using a bearer token that is sent along with the requests in the HTTP header. You need a bearer token to send an HTTP request through Postman.

To get a sample bearer token, launch the frontend, open the Network tab inside the console. Execute any activity that calls the backend, e.g., selecting a default dataset, and find that token inside the request. See pictures:

  1. Get the HTTP request on the Network tab
  1. In Postman, set the HTTP request type, e.g. GET or POST based on the intended request. You can find this out in that HTTP request in the Network tab under Headers > Request Method

  2. Scroll down under Headers to find the Authorization: section. This will contain the bearer token located after Bearer

  1. Copy paste the long bearer token (after Bearer ) into Postman > Auth > Type Bearer Token.
  1. Back in the browser Network tab, head to Payload and copy paste the Request Payload. This is the body of the request. If there's nothing in the Payload, you may disregard this step.

  2. Copy paste the body into Postman > Body (be sure to set the type of the body to raw). Click Send