Upload
Get Resource Upload Address
The invocation of this interface will return a resourceId
along with the putUrl
and headers
required for the image upload request. The user needs to then initiate a PUT
request to upload the actual image.
Request Example:
{"expireSec": 3600}
Response Example:
{
"resourceId": "0b00e7f2-5ea8-4976-8b5e-cf0a3fb2cd5d",
"putUrl": "http://tams-resource.oss-cn-hongkong.aliyuncs.com/temp%2F2023-08-22%2F0b00e7f2-5ea8-4976-8b5e-cf0a3fb2cd5d?Expires=1692675612&OSSAccessKeyId=LTAI5tBbAjwxqXDiu1tuYuke&Signature=P%2FpF7p%2BvRXTWtkg2Zz5aJAAVDjA%3D",
"headers": {
"Content-Type": "application/octet-stream",
"X-Oss-Callback": "eyJjYWxsYmFja1VybCI6Imh0dHBzOi8vZGV2LXRhbXMudGVuc29yLmFydC9yZXNvdXJjZS91cGxvYWQvY2FsbGJhY2siLCJjYWxsYmFja0JvZHkiOiJidWNrZXQ9JHtidWNrZXR9XHUwMDI2b2JqZWN0PSR7b2JqZWN0fVx1MDAyNmV0YWc9JHtldGFnfVx1MDAyNnNpemU9JHtzaXplfVx1MDAyNm1pbWVUeXBlPSR7bWltZVR5cGV9XHUwMDI2aW1hZ2VJbmZvLmhlaWdodD0ke2ltYWdlSW5mby5oZWlnaHR9XHUwMDI2aW1hZ2VJbmZvLndpZHRoPSR7aW1hZ2VJbmZvLndpZHRofVx1MDAyNmltYWdlSW5mby5mb3JtYXQ9JHtpbWFnZUluZm8uZm9ybWF0fSJ9"
}
}Afterwards, the actual image is uploaded using the provided
putUrl
andheaders
in the request. Upon successful response, theresourceId
obtained earlier can be used for subsequent operations such as generating images or other tasks.Request Example:
curl --location --request PUT 'http://tams-resource.oss-cn-hongkong.aliyuncs.com/temp%2F2023-08-22%2F0b00e7f2-5ea8-4976-8b5e-cf0a3fb2cd5d?Expires=1692675612&OSSAccessKeyId=LTAI5tBbAjwxqXDiu1tuYuke&Signature=P%2FpF7p%2BvRXTWtkg2Zz5aJAAVDjA%3D' \
--header 'X-Oss-Callback: eyJjYWxsYmFja1VybCI6Imh0dHBzOi8vZGV2LXRhbXMudGVuc29yLmFydC9yZXNvdXJjZS91cGxvYWQvY2FsbGJhY2siLCJjYWxsYmFja0JvZHkiOiJidWNrZXQ9JHtidWNrZXR9XHUwMDI2b2JqZWN0PSR7b2JqZWN0fVx1MDAyNmV0YWc9JHtldGFnfVx1MDAyNnNpemU9JHtzaXplfVx1MDAyNm1pbWVUeXBlPSR7bWltZVR5cGV9XHUwMDI2aW1hZ2VJbmZvLmhlaWdodD0ke2ltYWdlSW5mby5oZWlnaHR9XHUwMDI2aW1hZ2VJbmZvLndpZHRoPSR7aW1hZ2VJbmZvLndpZHRofVx1MDAyNmltYWdlSW5mby5mb3JtYXQ9JHtpbWFnZUluZm8uZm9ybWF0fSJ9' \
--header 'Content-Type: application/octet-stream' \
--data '{YourFilePath}'