The Postman request:


Request configuration

a.- Headers

Standard headers, nothing to update here.


b.- Body

Values that are used for this demo (selected as Postman type RAW):

KeyValueNotes
operationCategory

 "retrieval"

optional reference used by the service consumer to identify the file

documentKindCategory

"{{document-kind}}"

Document type, from "designpatenttrademarkutility model", for this example "patent"
documentNumber

"{{priority-number-retrieve}}"

priority number used before (to be sure that is in the system, in this case it was generated during the b.1.1.1.- getToken request

documentDate"{{priority-date-retrieve}}"priority date used before (to be sure that is in the system, in this case it was generated during the b.1.1.1.- getToken request
dasAccessCode"{{access-code}}"4 digit access code (from Postman environment)
applicationCategorynullcould be set as null or populated with the values if available
applicationNumbernullcould be set as null or populated with the values if available
applicationFilingDatenullcould be set as null or populated with the values if available


c.- Pre-request script

Not used in this case


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 201", function () {
    pm.response.to.have.status(201);
});

// the following case test for the requestAckId and then assigns the value to the osfAckId variable in the postman environment
pm.test("requestAckId", function () {
     var jsonData = pm.response.json();
    pm.expect(jsonData.requestAckId).not.eql(undefined);
    if (jsonData.requestAckId !== undefined) {
        console.log("requestAckId:"+jsonData.requestAckId)
        pm.expect(jsonData.requestAckId).not.equal(null)
        pm.environment.set("osfAckId",jsonData.requestAckId)
    }
});

// check if the location info is provided and then outputs it to the console
pm.test("Location", function () {
    var location = pm.response.headers.get("Location");
    pm.expect(location).not.eql(undefined);
    if (location !== undefined) {
        console.log("location:"+location)
    }
});


Expected response

e.- Body

We can see there the normal JSON response with the request Acknowledge Id (that is required to be able to retrieve the file(s))


f.- Headers

Normal headers.


g.- Test results

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



  • No labels