The Postman request:


Request configuration

a.- Headers

Standard headers, nothing to update here.


b.- Body

Values that are used for this demo:

KeyValueNotes
grant_typeclient_credentials
scopedas-api/office-exchangetype of access to give to the user
client_assertion_typeurn:ietf:params:oauth:client-assertion-type:jwt-bearerstandard jwt bearer authentication 
client_assertion{{client-assertion}}value to be retrieved from the Postman environment. Before executing this request, please generate your assertion as per indicated in these pages: e.3.- Executing the sample scripts under linux or e.4.- Executing the sample scripts via docker. Then update the Postman environment with the obtained JWT assertion


c.- Pre-request script

Nothing here.


d.- Tests script

The following script is executed after the request is sent, to evaluate the response and also to set up environment variables (if they are needed for following requests)

// following test will verify the expected response code for this request
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});



// tests validate the reception of the access code from das
pm.test("Received ACCESS-TOKEN for DAS access", function () {
    var jsonData = pm.response.json();
    pm.expect(jsonData.access_token).not.eql(undefined);
    if (jsonData.access_token !== undefined) {
        console.log("access-token received:"+jsonData.access_token)
//the new access token is saved in the postman environment for use in the other requests.
        pm.environment.set("access-token", jsonData.access_token);
    }
});



Expected response

e.- Body

In this case the body will mainly show the access token provided y the time left for its use.


f.- Headers

Normal headers.


g.- Test results

This depends on the test we set up in the test script



  • No labels