the url of the API
username/password which will authenticate against the API to get a token
in your request you can define the header Authorization: Bearer {{auth_token}}
| // add this in the postman collection root in the prescript tab | |
| pm.sendRequest({ | |
| // | |
| url: pm.environment.get('base_url') + '/core/api/auth/login', | |
| method: 'POST', | |
| header: { | |
| "Content-Type": "application/json", | |
| "Accept": "application/json" | |
| }, | |
| body: { | |
| mode: 'raw', | |
| raw: JSON.stringify({"username": pm.environment.get('username'), "password": pm.environment.get('password')}) | |
| } | |
| }, function(err, response) { | |
| // check, what the body of your result will look like | |
| let result = response.json(); | |
| pm.environment.set('auth_token', result.token); | |
| pm.environment.set('refresh_token', result.refresh_token) | |
| } | |
| ) |