CreateKnowledgeObjectUpload

Updated at:

Requests a file upload session and a temporary direct upload URL without creating a knowledge object or starting a build.

Operation description

Creates an upload session for a knowledge object. The tenant and caller identities are determined by the POP authentication context.

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:CreateKnowledgeObjectUpload

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

KnowledgeBaseId

string

Yes

The target knowledge base.

12345678-1234-4234-8234-123456789abc

FileName

string

Yes

The original file name. This is not used as the object ID.

policy.md

ContentType

string

Yes

The HTTP media type for the upload.

text/markdown

SizeBytes

integer

Yes

The size of the original file in bytes. The existing maximum size configured for single-file uploads applies, with a default of 100 MiB. If the size exceeds this limit, the InputTooLarge error is returned.

1024

ContentMd5

string

Yes

The Base64-encoded MD5 hash of the original file.

yaNM/IXZgmmMasifdgcavQ==

ContentSha256

string

No

The SHA-256 checksum of the original file.

ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

ClientToken

string

No

The idempotency key for the upload request.

upload-001

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The unique identifier of the request. You can use this ID to troubleshoot issues.

00000000-0000-4000-8000-000000000001

Success

boolean

Indicates whether the request is successful.

Data

object

The business data returned when the request is successful.

UploadId

string

The identifier of the upload session to be consumed by document creation, model update, or model import tasks. This is not a KnowledgeObjectId or TaskId.

12345678-1234-4234-8234-123456789abd

UploadUrl

string

The temporary direct upload URL.

https://example.invalid/short-lived-upload

ExpiresAt

integer

The expiration time of the upload URL, represented as a UNIX timestamp in milliseconds. The maximum validity period is 30 minutes, subject to the upper limit of the OSS signature configuration and the remaining session time. Use the value of this field as the actual expiration time.

1792456200000

RequiredHeaders

object

The HTTP headers that must be included in the direct upload request. The key is the actual header name, and the value is the header value.

string

The HTTP headers that must be included in the direct upload request. The key is the actual header name, and the value is the header value.

text/plain

Code

string

The business error code. You can use this code to determine the error type when the request fails.

InvalidParameter

Message

string

The error message returned when the request fails.

The request parameters are invalid

Examples

Success response

JSON format

{
  "RequestId": "00000000-0000-4000-8000-000000000001",
  "Success": false,
  "Data": {
    "UploadId": "12345678-1234-4234-8234-123456789abd",
    "UploadUrl": "https://example.invalid/short-lived-upload",
    "ExpiresAt": 1792456200000,
    "RequiredHeaders": {
      "key": "text/plain"
    }
  },
  "Code": "InvalidParameter",
  "Message": "The request parameters are invalid"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The request parameters are invalid.
400 UploadIncomplete The upload or content is invalid.
400 InputTooLarge The upload or content is invalid.
500 InternalError The knowledge base operation failed. Use RequestId to contact support.
403 Forbidden You are not authorized to perform this operation.
404 ResourceNotFound The requested resource does not exist or is not visible.
409 Conflict The resource state conflicts with this operation.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.