schm-oss-processing-sapi
home
schm-oss-processing-sapi
API Description: The Aliyun Object Storage OSS API application allows for operations such as reading, writing, modifying, downloading, and online previewing on storage objects.
Official description document for Aliyun object OSS: https://www.aliyun.com/product/oss
DEV_URL (DEV environment request address): https://schm-api-dev.shiseido.cn/schm-oss-processing-sapi
UAT_URL (UAT environment request address): https://schm-api-test.shiseido.cn/schm-oss-processing-sapi
PROD_URL(PROD environment request address): https://schm-api.shiseido.cn/schm-oss-processing-sapi
API Request Method:
Use HTTP request, the following requirements need to be passed in: Header, Request Body, Request Param, etc.
General Header Parameters
Authentication Information
All requested headers must contain the following key value parameters as authentication information, which needs to be applied with the administrator.
client_id: fa98****3452
client_secret: 108b****41f2
OSS Connection Information
The API can dynamically connect to OSS and then operate on the connected OSS. There are two connection methods.
- Fill in the complete endPoint, accessKeyId, accessKeySecret, and bucketName information to connect to the target OSS.
- Enter endPoint, accessKeyId, accessKeySecret, and bucketName information in the system database in advance, define the primary key for this piece of data, and pass it in as an OSS parameter. The system will automatically connect.
So there are two ways to pass in OSS information in the Header.
Fill in complete information:
endPoint: http****s.com
accessKeyId: LTAI****YGqY
accessKeySecret: Whn3****Hjl7
bucketName: cna****nter
Or
Fill in the registered OSS primary key:
oss: mdm****nter
The system will prioritize the OSS primary key.
So the Header parameter needs to include Authentication Information and OSS Connection Information
API List:
Request Path | Description |
---|---|
/object/list | Pass in file (oss object) address prefix, returns all files and folders under this address prefix. |
/object/get | Pass in file full path, returns the content of the file as text. |
/object/move | Pass in the "source full path" and "target full path" to move the file. Since the complete path is passed in, it can also serve as a renaming function. |
/object/put | Write the content in the request body into the file corresponding to the parameter (full path of the file). If the file does not exist, it will be created. |
/object/download | Download files in streaming format. |
/object/upload | Upload the file to the specified path. |
/object/copy | Pass in the "source full path" and "target full path" to copy the file. |
/object/delete | Pass in the full path of the file and delete the file. |
List Object
API Request Address: /object/list
API Description Pass in file (oss object) address prefix, returns all files and folders under this address prefix.
API Request Method: HTTP POST
Request Header Description:
Description | Parameter Name | Mandatory or not | Data Type |
---|---|---|---|
Top-level directory address to be listed | path | Y | String |
accessKeyId needed to connect OSS | accessKeyId | N | String |
accessKeySecret needed to connect OSS | accessKeySecret | N | String |
oss bucket | bucket | N | String |
oss key recorded in the system | oss | N | String |
oss code or oss connect information setting, only one should be selected to input. If both inputs are made, the OSS code will be given priority.
Request Body Description:
Field Description | Field Name | Required | Type |
---|---|---|---|
Top-level directory address for file list to be listed | path | Y | String |
Maximum return entry | maxKeys | N | String or Number |
Key words for fuzzy search. Using the path parameter as the directory, search for all subdirectories and files under this directory, and list file entries that contain fuzzy search keywords. | search | N | String or Number |
Sample Parameter:
{
"path":"MDM/MULE/"
}
Due to the fact that OSS is a flat storage mechanism, which means that all files are placed without a hierarchical structure, and only prefixes are used to simulate directory hierarchy.
The list API actually lists all files prefixed with the path parameter, so by default, it appears to return all files in that directory and its subdirectories.
If you want to return all the files and folders in the current directory of path, the path parameter can end with "/". For example, "path": "MDM/MULE/BACKUP/" will only return files and folders under the BACKUP directory, and their subdirectory contents will not be returned.
Sort by file modification time in reverse order (from new to old).
Returned Value:
Description | Field Name | Data Type |
---|---|---|
List of files and directories | ObjectList | Array |
Success flag | Code | String |
OSS bucket name | bucketName | String |
Full path to file or folder | Key | String |
Last-modified time (timestamp) | lastModified | Number |
File size. If 0 is returned, it indicates that this is a folder | size | String |
File name, this field is empty when returning a folder | fileName | String |
File type (extension), this field is empty when returning a folder | fileType | String |
A link that can display opening files online, and this field will only be returned if the osskey is pre registered | viewPath | String |
Sample Returned Value:
{
"ObjectList": [{
"bucketName": "cna-dev-jobcenter",
"lastModified": 1655026866000,
"size": 0,
"key": "MDM/MULE/",
"fileName": null,
"fileType": null,
"viewPath": null
},
{
"bucketName": "cna-dev-jobcenter",
"lastModified": 1655026882000,
"size": 0,
"key": "MDM/MULE/BACKUP/",
"fileName": null,
"fileType": null,
"viewPath": null
},
{
"bucketName": "cna-dev-jobcenter",
"lastModified": 1665561801000,
"size": 427,
"key": "MDM/MULE/BACKUP/202210/4000004574_BatchMaster_20220622-142424-344.xml",
"fileName": "4000004574_BatchMaster_20220622-142424-344.xml",
"fileType": "xml",
"viewPath": "https://schm-api-test.shiseido.cn/schm-oss-processing-sapi/object/view?oss=mdm&path=MDM/MULE/BACKUP/202210/4000004574_BatchMaster_20220622-142424-344.xml"
},
{
"bucketName": "cna-dev-jobcenter",
"lastModified": 1665561816000,
"size": 435,
"key": "MDM/MULE/BACKUP/202210/4000004574_BatchMaster_20220622-142424-357.xml",
"fileName": "4000004574_BatchMaster_20220622-142424-357.xml",
"fileType": "xml",
"viewPath": "https://schm-api-test.shiseido.cn/schm-oss-processing-sapi/object/view?oss=mdm&path=MDM/MULE/BACKUP/202210/4000004574_BatchMaster_20220622-142424-357.xml"
}
],
"Code": "Success"
}
Get Object
API Request Address: /object/get
API Description: Pass in file full path, returns the content of the file as text.
API Request Method: HTTP POST
Header Parameter:
General header parameters, no additional parameters.
Request Body Description:
Description | Parameter Name | Mandatory or not | Data Type |
---|---|---|---|
The complete path of the file that content needs to be obtained from | path | Y | String |
Sample Parameter:
{
"path":"MDM/MULE/BACKUP/202210/4000004574_BatchMaster_20220622-142424-344.xml"
}
Sample Returned Value:
The entire return body is the file content
the path file content
Move Object
API Request Address: /object/move
API Description: Pass in the "source full path" and "target full path" to move the file. Since the complete path is passed in, it can also serve as a renaming function.
API Request Method: HTTP POST
Header Parameter:
General header parameters, no additional parameters.
Request Body Description:
Description | Parameter Name | Mandatory or not | Data Type |
---|---|---|---|
Source full path | sourceObject | Y | String |
Target full path | destinationObject | Y | String |
Sample Parameter
{
"sourceObject": "MDM/MULE/1000004574_BatchMaster_20220707-142424-100.xml",
"destinationObject": "MDM/MULE/ERROR/1000004574_BatchMaster_20220707-142424-100.xml"
}
Returned Value
Field Description | Field Name | Type |
---|---|---|
Success flag | Code | String |
Source full path | sourceObject | String |
Target full path | destinationObject | String |
Sample Returned Value:
{
"Code": "Success",
"SourceObject": "MDM/MULE/1000004574_BatchMaster_20220707-142424-100.xml",
"DestinationObject": "MDM/MULE/ERROR/1000004574_BatchMaster_20220707-142424-100.xml"
}
Put Object
API Request Address: /object/put
API Description: Write the content in the request body into the file corresponding to the parameter (full path of the file). If the file does not exist, it will be created.
API Request Method: HTTP POST
Header Parameter:
In addition to the general header parameters, the following is also necessary:
Parameter Description | Parameter Name | Mandatory or not | Data Type |
---|---|---|---|
The complete path of the file that needs to be changed | path | Y | String |
Sample Additional Header Parameter:
path: MDM/MULE/1000004574_BatchMaster_20220707-142424-100.xml
Request Body Description:
The entire request body content is the content text that needs to be written to the file
Returned Value:
Description | Field Name | Data Type |
---|---|---|
File name | (Dynamic file name as key) | Array |
Success flag | Code | String |
OSS bucket name | bucketName | String |
Full path to file or folder | Key | String |
Last-modified time (timestamp) | lastModified | Number |
File size. If 0 is returned, it indicates that this is a folder | size | String |
File name, this field is empty when returning a folder | fileName | String |
File type (extension), this field is empty when returning a folder | fileType | String |
A link that can display opening files online, and this field will only be returned if the osskey is pre registered | viewPath | String |
Sample Returned Value:
{
"MDM/MULE/BACKUP/TEST/test.file": {
"Content-Type": "application/octet-stream",
"Date": 1670293319000,
"Last-Modified": 1670293319000,
"bucketName": "cna-dev-jobcenter",
"fileName": "test.file",
"fileType": "file",
"viewPath": "https://schm-api-test.shiseido.cn/schm-oss-processing-sapi/object/view?oss=mdm&path=MDM/MULE/BACKUP/TEST/test.file"
},
"Code": "Success"
}
Download Object
API Request Address: /object/download
API Description: Download files in streaming format.
Request method: HTTP POST
Header Parameter:
General header parameters, no additional parameters.
Request Body Description:
Description | Parameter Name | Mandatory or not | Data Type |
---|---|---|---|
The complete path to the downloaded file is required | path | Y | String |
Sample Parameter:
{
"path": "MDM/MULE/1000004574_BatchMaster_20220707-142424-100.xml"
}
Returned Value:
Return the stream of the file, which can be downloaded directly
Uplaod Object
API Request Address: /object/upload
API Description: Upload the file to the specified path.
API Request Method: HTTP POST multipart/form-data
Header Parameter:
General header parameters, no additional parameters.
Request Body Description:
Parameters need to be passed in form-data format.
Description | Parameter Name | Mandatory or not | Data Type |
---|---|---|---|
Files that need to be uploaded, support multiple files | file | Y | file |
The path where files are uploaded and placed, and all files will be placed in this directory | path | Y | String |
Sample Parameter:
path: MDM/MULE/BACKUP/TEST/
file: !file1,!file2
Returned Value:
Description | Field Name | Data Type |
---|---|---|
File name | (Dynamic file name as key) | Object |
Success flag | Code | String |
OSS bucket name | bucketName | String |
Full path to file or folder | Key | String |
Last-modified time (timestamp) | lastModified | Number |
File size. If 0 is returned, it indicates that this is a folder | size | String |
File name, this field is empty when returning a folder | fileName | String |
File type (extension), this field is empty when returning a folder | fileType | String |
A link that can display opening files online, and this field will only be returned if the osskey is pre registered | viewPath | String |
Sample Returned Value:
{
"MDM/MULE/BACKUP/TEST/test.file": {
"Content-Type": "application/octet-stream",
"Date": 1670293319000,
"Last-Modified": 1670293319000,
"bucketName": "cna-dev-jobcenter",
"fileName": "test.file",
"fileType": "file",
"viewPath": "https://schm-api-test.shiseido.cn/schm-oss-processing-sapi/object/view?oss=mdm&path=MDM/MULE/BACKUP/TEST/test.file"
},
"MDM/MULE/BACKUP/TEST/test2.file": {
"Content-Type": "application/octet-stream",
"Date": 1670293319000,
"Last-Modified": 1670293319000,
"bucketName": "cna-dev-jobcenter",
"fileName": "test2.file",
"fileType": "file",
"viewPath": "https://schm-api-test.shiseido.cn/schm-oss-processing-sapi/object/view?oss=mdm&path=MDM/MULE/BACKUP/TEST/test2.file"
},
"Code": "Success"
}
Copy Object
API Request Address: /object/copy
API Description: Pass in the "source full path" and "target full path" to copy the file.
API Request Method: HTTP POST
Header Parameter:
General header parameters, no additional parameters.
Request Body Description:
Description | Parameter Name | Mandatory or not | Data Type |
---|---|---|---|
source full path | sourceObject | Y | String |
target full path | destinationObject | Y | String |
Sample Parameter:
{
"sourceObject": "MDM/MULE/1000004574_BatchMaster_20220707-142424-100.xml",
"destinationObject": "MDM/MULE/ERROR/1000004574_BatchMaster_20220707-142424-100.xml"
}
Returned Value:
Field Description | Field Name | Type |
---|---|---|
Success flag | Code | String |
Sample Returned Value:
{
"Code": "Success"
}
Delete Object
API Request Address: /object/delete
API Description: Pass in the full path of the file and delete the file.
API Request Method: HTTP POST
Note: This feature cannot delete folders, only specific files can be deleted.
Header Parameter:
General header parameters, no additional parameters.
Request Body Description:
Description | Parameter Name | Mandatory or not | Data Type |
---|---|---|---|
The complete path of the file that content needs to be obtained from | path | Y | String |
Sample Parameter:
{
"path":"MDM/MULE/BACKUP/202210/4000004574_BatchMaster_20220622-142424-344.xml"
}
Returned Value:
Field Description | Field Name | Type |
---|---|---|
Success flag | Code | String |
Sample Returned Value:
{
"Code": "Success"
}
Currently, regardless of whether the deleted file exists or not, success will be returned.
View Object
API Request Address: /object/view
API Description: The viewPath returned by API such as list, put, and upload can directly display the file content.
API Request Method: HTTP GET
Header Parameter:
The authentication parameters are normal, and the OSS connection method can only use the method of pre writing connection information as the OSS key in the database.
Description | Parameter Name | Mandatory or not | Type |
---|---|---|---|
The primary key of the pre recorded OSS connection information data entry | oss | Y | String |
Sample Url
https://schm-api-test.shiseido.cn/schm-oss-processing-sapi/object/view?oss=mdm&path=MDM/MULE/BACKUP/TEST/test2.file
The file content will be directly displayed, supporting PDF and image types etc.