Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If that is the case, the current request can be used to retrieve a new url, using the file-id that was obtained before

The Postman request:

Image RemovedImage Added

...

Request configuration

a.- Headers

Standard headers, nothing to update here.

Expand
titleClick to expand...

Image RemovedImage Added

...

b.- Body

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

KeyValueNotes
fileId

"{{file-id}}"

file Id obtained before via a.1.1.2.- obtain fileId and a presigned URL to upload a big size document file (POST)


Expand

Image RemovedImage Added

...

c.- Pre-request script

Not used 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)

Code Block
languagejs
themeRDark
linenumberstrue
collapsetrue
// following test will verify the expected response code for this request

pm.test("Status code is 204", function () {
    pm.response.to.have.status(204);
});
// the following test will retrieve the updated url from the response headers
pm.test("location is not null", () => {
        const headers = pm.response.headers.get('Location')
        pm.expect(headers).not.eql('undefined');
        if (headers !== undefined) {
            console.log("upload-url:"+headers)
            pm.environment.set("upload-url", headers);
    }

});

...

Expected response

e.- Body

equal 1 for the success of the Put request

Image RemovedImage Added

...

f.- Headers

The headers provide the updated url in the location entry. The post request test, takes care of updating the upload url on the environment conifguration

Expand

Image RemovedImage Added

...

g.- Test results

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

Image RemovedImage Added

...