getOSSTempAuthor

更新时间:
复制 MD 格式

Call `getOSSTempAuthor` to obtain authorization for Object Storage Service (OSS). After authorization is granted, you can use an OSS client to upload attachments. You must call this operation before uploading an attachment with the `Add` or `QuestionReply` operations.

Return parameters

Name

Type

Example

Description

data

Object

-

The data returned by the API operation. For more information, see data.

success

String

true
Indicates whether the API call is successful. Valid values:
  • true: The call is successful.
  • false: The call failed.

message

String

successful

The error message. If the API call fails, a detailed error message is returned. Use this message to troubleshoot the call.

code

Int

200

The error code.

Table 1. data

Name

Type

Example

Description

accessId

String

LTA****4r3

The AccessKey ID of the OSS client account.

expire

String

1573129988

The UNIX timestamp when the OSS authorization expires. Use this timestamp to determine whether to request a new temporary authorization.

host

String

http://work-order.oss-cn-hangzhou.aliyuns.com/

The endpoint for submitting attachments to OSS.

policy

String

eyJleHBpcmF0aW9uIjoiMjAxOS0xMS0wN1QxMjozMzowOC40NzFaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMjA5NzE1Ml0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJwb3BfdGVtcDI2ODQyLyJdXX0

The policy for attachments in OSS.

dir

String

pop_temp123

You must prefix the filename with this value when you upload an attachment.

signature String 5be4vr***********37AE=

The OSS signature.

Note
  • This is a temporary authorization. The validity period is specified in the return parameters and is typically 2 minutes. The maximum size of an attachment that you can upload is 2 MB. For more information about how to authorize a third party to directly upload files to OSS, see Authorize a third party to upload files
  • After you obtain authorization, upload the attachment to OSS. After the upload is successful, record the returned path. When you call the `Add` or `QuestionReply` operations, pass the returned path as a parameter.
Server-side signature for direct upload.

Examples

{
  "message": "successful",
  "data": {
    "expire": "1573129988",
    "host": "http://work-order.oss-cn-hangzhou.aliyuncs.com/",
    "dir": "pop_temp26842/",
    "policy": "eyJleHBpcmF0aW9uIjoiMjAxOS0xMS0wN1QxMjozMzowOC40NzFaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMjA5NzE1Ml0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJwb3BfdGVtcDI2ODQyLyJdXX0=",
    "accessId": "LTA******54r3",
    "signature": "5be4*********37AE="
  }, 
  "code": "200",
  "success": true
}