schm-oss-processing-sapi

(0 reviews)

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.

  1. Fill in the complete endPoint, accessKeyId, accessKeySecret, and bucketName information to connect to the target OSS.
  2. 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 PathDescription
/object/listPass in file (oss object) address prefix, returns all files and folders under this address prefix.
/object/getPass in file full path, returns the content of the file as text.
/object/movePass 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/putWrite 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/downloadDownload files in streaming format.
/object/uploadUpload the file to the specified path.
/object/copyPass in the "source full path" and "target full path" to copy the file.
/object/deletePass 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:

DescriptionParameter NameMandatory or notData Type
Top-level directory address to be listedpathYString
accessKeyId needed to connect OSSaccessKeyIdNString
accessKeySecret needed to connect OSSaccessKeySecretNString
oss bucketbucketNString
oss key recorded in the systemossNString

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 DescriptionField NameRequiredType
Top-level directory address for file list to be listedpathYString
Maximum return entrymaxKeysNString 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.searchNString 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:

DescriptionField NameData Type
List of files and directoriesObjectListArray
Success flagCodeString
OSS bucket namebucketNameString
Full path to file or folderKeyString
Last-modified time (timestamp)lastModifiedNumber
File size. If 0 is returned, it indicates that this is a foldersizeString
File name, this field is empty when returning a folderfileNameString
File type (extension), this field is empty when returning a folderfileTypeString
A link that can display opening files online, and this field will only be returned if the osskey is pre registeredviewPathString

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:

DescriptionParameter NameMandatory or notData Type
The complete path of the file that content needs to be obtained frompathYString

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:

DescriptionParameter NameMandatory or notData Type
Source full pathsourceObjectYString
Target full pathdestinationObjectYString

Sample Parameter

{
    "sourceObject": "MDM/MULE/1000004574_BatchMaster_20220707-142424-100.xml",
    "destinationObject": "MDM/MULE/ERROR/1000004574_BatchMaster_20220707-142424-100.xml"
}

Returned Value

Field DescriptionField NameType
Success flagCodeString
Source full pathsourceObjectString
Target full pathdestinationObjectString

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 DescriptionParameter NameMandatory or notData Type
The complete path of the file that needs to be changedpathYString

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:

DescriptionField NameData Type
File name(Dynamic file name as key)Array
Success flagCodeString
OSS bucket namebucketNameString
Full path to file or folderKeyString
Last-modified time (timestamp)lastModifiedNumber
File size. If 0 is returned, it indicates that this is a foldersizeString
File name, this field is empty when returning a folderfileNameString
File type (extension), this field is empty when returning a folderfileTypeString
A link that can display opening files online, and this field will only be returned if the osskey is pre registeredviewPathString

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:

DescriptionParameter NameMandatory or notData Type
The complete path to the downloaded file is requiredpathYString

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.

DescriptionParameter NameMandatory or notData Type
Files that need to be uploaded, support multiple filesfileYfile
The path where files are uploaded and placed, and all files will be placed in this directorypathYString

Sample Parameter:


path: MDM/MULE/BACKUP/TEST/

file: !file1,!file2

Returned Value:

DescriptionField NameData Type
File name(Dynamic file name as key)Object
Success flagCodeString
OSS bucket namebucketNameString
Full path to file or folderKeyString
Last-modified time (timestamp)lastModifiedNumber
File size. If 0 is returned, it indicates that this is a foldersizeString
File name, this field is empty when returning a folderfileNameString
File type (extension), this field is empty when returning a folderfileTypeString
A link that can display opening files online, and this field will only be returned if the osskey is pre registeredviewPathString

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:

DescriptionParameter NameMandatory or notData Type
source full pathsourceObjectYString
target full pathdestinationObjectYString

Sample Parameter:

{
    "sourceObject": "MDM/MULE/1000004574_BatchMaster_20220707-142424-100.xml",
    "destinationObject": "MDM/MULE/ERROR/1000004574_BatchMaster_20220707-142424-100.xml"
}

Returned Value:

Field DescriptionField NameType
Success flagCodeString

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:

DescriptionParameter NameMandatory or notData Type
The complete path of the file that content needs to be obtained frompathYString

Sample Parameter:

{
  "path":"MDM/MULE/BACKUP/202210/4000004574_BatchMaster_20220622-142424-344.xml"
}

Returned Value:

Field DescriptionField NameType
Success flagCodeString

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.

DescriptionParameter NameMandatory or notType
The primary key of the pre recorded OSS connection information data entryossYString

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.


Reviews