It might happen, that due to the expiration of the url provided by a.1.1.2.- obtain fileId and a presigned URL to upload a big size document file (POST), the file cannot be uploaded (the link should be valid for some time, but maybe due to some unforseen issue the file was not uploaded on time).
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:
Standard headers, nothing to update here.
Values that are used for this demo (selected as Postman type RAW):
Key | Value | Notes |
---|---|---|
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) |
Not used here
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 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); } }); |
equal 1 for the success of the Put request
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
This depends on the test we set up in the test script