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 with JSON format):

KeyValueNotes
operationCategory

"registration"

the type of category of the operation we are trying to perform

documentKindCategory"{{document-kind}}"Document type, from "designpatenttrademarkutility model", for this example "patent"
documentNumber "{{priority-number}}"priority number generated before (in this case it was generated during the 1.1.1.1.- getToken (POST) request )
documentDate"{{priority-date}}"priority date generated before (in this case it was generated during the 1.1.1.1.- getToken (POST) request )
dasAccessCode"{{access-code}}"4 digit access code (from Postman environment)
applicationCategory"{{application-category}}"Document type, from "designpatenttrademarkutility model", for this example "patent"
applicationNumber

"{{application-number}}"

application number generated before (in this case it was generated during the 1.1.1.1.- getToken (POST) request )
applicationFilingDate

"{{application-date}}"

application date generated before (in this case it was generated during the 1.1.1.1.- getToken (POST) request )

email"{{email}}"email for communications
fileId"{{file-id}}"fileId obtained during b.1.2.2.- obtain fileId to delete

  
}


c.- Pre-request script

This script automatically generates a general reference and updates the Postman environment with it.

setting the file reference (only for testing)
// this is option and to setup a delay for executing the automate process with Newman, so this is to be sure that the file is ready for registration
setTimeout(() => console.log("3 second delay"), 30000);



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 test checks if the system has provided a the Acknowledgement Id for the request
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.environment.set("request-ack", jsonData.requestAckId);
    }
});
//this tests if the location is provided in the response
pm.test("Location", function () {
    var location = pm.response.headers.get("Location");
    pm.expect(location).not.eql(undefined);
    if (location !== undefined) {
        console.log("location:"+location)
        pm.environment.set("location", location);
    }
});

Expected response

e.- Body

Here is the json response with the details of the registered record. Particularly the request AckId and the status of the request(for this operation, "registration - recorded")


f.- Headers

Normal headers.


g.- Test results

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



  • No labels