The Object Storage Service (OSS) is a generic Cloud Storage Service that is part of the Data Management API. In this task, you upload the model to translate to OSS. While you can use any model for this purpose, we recommend that you use the file box.ipt, which is available in the tutorial_data folder.
In this tutorial, you will use a Postman environment variable named ossBucketKey
to hold the Object Key of the Bucket that contains your files in the cloud. If you already have a bucket (from a previous tutorial), carry out step 1, and ignore the rest.
-
Specify a value for the Bucket Key in the Postman Environment Variable named
ossBucketKey
:-
Click the Environment quick look icon (the eye icon) on the upper right corner of Postman.
-
In the CURRENT VALUE column, in the ossBucketKey row, specify a name for the Bucket that stores your files.
Notes:
-
The Bucket name needs to be unique throughout the OSS service. if a Bucket with the name you specified exists, the system returns a
409
conflict error in step 5. If you receive this error, change the value of this variable and try again. -
The Bucket name must consist of only lower-case characters, numbers 0-9, and the underscore (_) character.
-
-
Click the Environment quick look icon to hide the variables.
-
-
In the Postman sidebar, click Task 2 - Upload Source File to OSS > POST Create a Bucket. The request loads.
-
Click the Body tab, and verify that the
bucketkey
attribute has been set to the variableossBucketKey
. -
Click Send. If the request is successful, you should see a screen similar to the following image.
Before you upload a file to OSS, you must obtain a signed upload URL for the file. To obtain a signed upload URL:
-
In the Postman sidebar, click Task 2 - Upload Source File to OSS > GET Obtain Signed URL. The request loads.
Note the use of
ossBucketkey
andossSourceFileObjectKey
as URI parameters. -
Click the Environment quick look button and set the Postman environment variable
ossSourceFileObjectKey
tobox.ipt
, which you will use as the Object Key. -
Click the Params tab, and note that the
minutesExpiration
query parameter is defined as 5 minutes. Change this value to 10. -
Click Send. A script in the Tests tab updates the following Postman environment variables:
Variable Name Description UploadKey The upload key assigned to the file you want to upload. ContentUploadSignedURL The signed upload URL you must use to upload the source file. You should see a screen similar to the following image:
Now that you have obtained a signed upload URL, you can go ahead and upload the file box.ipt to OSS.
-
Download the file box.ipt from the tutorial_data folder of this tutorial.
-
In the Postman sidebar, click Task 2 - Upload Source File to OSS > PUT Upload the File. The request loads.
Note the use of
ContentUploadSignedURL
as the URI. -
Click the Body tab.
-
Click Select File and select the file box.ipt, which you downloaded in step 1.
-
Click Send to upload the file.
Although you uploaded the source file in one go, it is possible to split a file into chunks and upload the file one chunk at a time. Once all the chunks are uploaded you must inform OSS that the upload operation is complete. Even though you uploaded the file in one go, you must finalize the upload by informing OSS that the upload is done. To finalize the upload:
-
In the Postman sidebar, click Task 2 - Upload Source File to OSS > POST Finalize Upload. The request loads.
Note the use of
ossBucketkey
andossSourceFileObjectKey
as URI parameters. -
Click the Body tab, and verify that the
uploadKey
attribute has been set to the variableUploadKey
. -
Click the Headers tab. Notice that the
Authorization
andContent-Type
Headers are already defined. -
Click Send to finalize the upload. A script in the Tests tab updates the following Postman environment variables:
Variable Name Description t1_ossSourceFileObjectKey Object Key of the source file. Should be box.ipt
.t1_ossSourceFileURN Value of the objectId
attribute in the JSON response. This is the URN of the source file.t1_ossEncodedSourceFileURN The URN of the source file, converted to a Base64-encoded URN. You should see a screen similar to the following image: