UploadSemanticFile

Updated at:

Requests a temporary OSS PUT upload URL. Complete the PUT upload before the URL expires, then pass the returned FileId to the ReferenceFileIds parameter of CreateSemanticJob.

Operation description

Scenarios

Requests an upload slot for a reference file to prepare a file for the singleTableFile source of CreateSemanticJob.

Procedure

  1. Pass the file name, MIME type, and actual size to this operation to obtain Data.UploadUrl and Data.FileId.

  2. Perform an HTTP PUT upload with the same Content-Type before the UploadUrl expires.

  3. After the upload is complete, use FileId as the only element of CreateSemanticJob.ReferenceFileIds.

Security considerations

UploadUrl is a short-lived pre-signed PUT URL. The holder can write to the corresponding object. Do not log, share, or persist this URL.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:UploadSemanticFile

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

FileName

string

Yes

The original file name of the reference file to upload. Maximum length: 255 characters. When singleTableFile uses a FileId, only CSV or XLSX files are supported.

reference.pdf

ContentType

string

Yes

The MIME type of the object to upload. Maximum length: 128 characters. This value is included in the UploadUrl signature. Use the same Content-Type when performing the PUT request.

application/pdf

SizeBytes

integer

Yes

The size of the file to upload, in bytes. This value is recorded as attachment metadata. Specify the actual file size.

1024

Construct the request parameters based on the description of each request field.

Response elements

Element

Type

Description

Example

object

The standard response for requesting an attachment upload slot. After the PUT upload is complete, Data.FileId can be used as the only file reference in CreateSemanticJob.ReferenceFileIds.

RequestId

string

The request ID. Used for locating logs and troubleshooting issues.

676271D6-53B4-57BE-89FA-72F7AE1418DF

Success

boolean

Indicates whether the request was successful.

Data

object

The attachment upload slot information. PUT the file to Data.UploadUrl before Data.ExpiresAt, then use Data.FileId to create a single-file semantic task.

FileId

string

The unique identifier of the attachment. After completing the PUT upload to UploadUrl, pass this value to the ReferenceFileIds parameter of CreateSemanticJob.

FID1

UploadUrl

string

The temporary OSS PUT upload URL. Valid for 30 minutes. Only the specified object can be uploaded. Use the ContentType from the request when performing the PUT request. Do not log or distribute the full URL.

https://example.com/temporary-upload-url

ExpiresAt

integer

The expiration time of UploadUrl, expressed as a Unix timestamp in milliseconds. After this time, call UploadSemanticFile again to request a new URL.

1700001800000

For the meaning of response fields and their relationships to subsequent calls, refer to the description of each field.

Examples

Success response

JSON format

{
  "RequestId": "676271D6-53B4-57BE-89FA-72F7AE1418DF",
  "Success": false,
  "Data": {
    "FileId": "FID1",
    "UploadUrl": "https://example.com/temporary-upload-url",
    "ExpiresAt": 1700001800000
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.