CreateContextModel

Updated at:

Creates a semantic model.

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

log:CreateContextModel

create

*ContextModel

acs:log:{#regionId}:{#accountId}:contextmodel/{#name}

None None

Request syntax

POST /context-models HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body. A JSON object that describes the context model to be created, including the model identifier, display name, description, and referenced sources.

description

string

No

The model description, which is used for explanatory text. For short titles displayed in the UI, use displayName.

End-to-end coverage from order creation to payment

displayName

string

No

The display name, which serves as a short title for UI display. It can contain Chinese characters, spaces, and punctuation marks, with a maximum length of 256 characters (counted by characters, not bytes). If this parameter is not specified or is left empty, it indicates that the display name is not set. In this case, the API returns an empty string "" (it is not backfilled as name). For display purposes, it can fall back to displayName || name.

Order analysis model

name

string

Yes

The identifier of the context model. It supports only uppercase and lowercase letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters in length. It must be unique within the same Alibaba Cloud account and cannot be modified after creation. All other context model API operations use this name to locate the resource.

orders

sources

object

No

The referenced sources. The key is the project name (so the same project does not appear repeatedly), and the value is an array of selected Logstore names under the project. ["*"] indicates all Logstores under the project. Otherwise, it is an exact list of Logstore names. Note: An empty array [] is rejected (400). To select all, you must explicitly specify ["*"] to prevent an accidentally passed empty set from being expanded to all Logstores. ["*"] cannot be mixed with specific Logstore names (400). Wildcard or prefix matching is not supported. Names containing * are rejected (400). If this field is not specified, no sources are referenced.

{"cn-hangzhou-app-logs": ["*"], "cn-hangzhou-order-logs": ["accesslog", "errorlog"]}

array

No

The list of selected Logstore names under the project, which must be a non-empty array. ["*"] indicates all Logstores under the project and cannot be mixed with specific Logstore names.

string

No

The name of the Logstore under the project. The Logstore must exist, and its parent project must belong to the current account. Wildcards and prefix matching are not supported. Names containing an asterisk (*) are rejected.

order-log

Response elements

Element

Type

Description

Example

object

The response body.

status

string

The call result status. If the creation is successful, success is returned. If the call fails, the error is indicated by the HTTP status code and errorCode, and this field is not returned.

success

Examples

Success response

JSON format

{
  "status": "success"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.