Tips for using Postman

This is beyond the scope of the workshop. The following notes may be helpful in configuring your environment. An export of preconfigured envs to work with the official demo and a collection of useful requests, more than the ones used in the tutorial, are available for download

Create a Collection in Postman

Set the following Pre-request Script

Customize the server address, username, and password for your site.

const loginRequest = {
  url: pm.environment.get('dspaceresturl') + "/api/authn/login",
  method: 'POST',
  header: 'Content-Type: application/x-www-form-urlencoded',
  body: "user="+pm.environment.get('dspaceuser')+"&password="+pm.environment.get('dspacepwd')
};
pm.sendRequest(loginRequest, function (err, response) {
    var s = response.headers.get("Authorization");
    if (s == null) {
        s = "";
    } else {
        s = s.replace(/Bearer /,"");
    }
    pm.environment.set("auth_token", s);
});

Set the following Environment Variable

Create one or more environments with the following variables

Please note that the dspaceuser and dspacepwd must be URLEncoded (i.e. + become %2B). To setup an env for anonymous user simple keep the dspaceuser and dspacepwd empty

Set the following Authorization Value

In your requests

Set Authorization to “Inherit from Parent”