The Postman request:
Standard headers, nothing to update here.
Values that are used for this demo (selected as Postman type RAW):
Key | Value | Notes |
---|---|---|
fileReference | "{{file-reference}}" | optional reference used by the service consumer to identify the file |
fileFormatCategory | "{{file-format}}" | Can be pdf,zip,xml (for the current testĀ b.1.2.- request to delete it will by zip) |
fileChecksum | "{{file-checksum}}" | mandatory checksum of the file to upload for validation purpose. Please check here to see how to generate it, then update the PostmanĀ environment |
This script automatically generates a general reference and updates the Postman environment with it.
// setting the fileReference var currentTimestamp = "file_reference_created_on_" + (Math.floor(Date.now() / 1000) ); pm.environment.set('file-reference',currentTimestamp ); console.log("bearer=",pm.environment.get('access-token')) |
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); }); // this tests if the file-id is received and then updates the postman environment with it pm.test("file-id received", function () { var jsonData = pm.response.json(); pm.expect(jsonData.fileId).not.eql(undefined); if (jsonData.fileId !== undefined) { console.log("file-id:"+jsonData.fileId) pm.environment.set("file-id", jsonData.fileId); } }); // this tests if the upload URL is received and then updates the postman environment with it pm.test("upload URL received", function () { var jsonData = pm.response.json(); pm.expect(jsonData.fileUploadUrl).not.eql(undefined); if (jsonData.fileUploadUrl !== undefined) { console.log("upload-url:"+jsonData.fileUploadUrl) pm.environment.set("upload-url", jsonData.fileUploadUrl); } }); |
We can see there the normal JSON response with the fileId and fileUploadUrl that is being provided by the system for the upload of the file we want to register in DAS
Normal headers.
![]() |
This depends on the test we set up in the test script