CreatePromptTemplate
Create a prompt template.
Operation description
This API does not currently support the creation of text-to-image prompt templates.
Try it now
You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After a successful run, OpenAPI Explorer can automatically generate SDK code examples.
RAM authorization
The following table describes the authorization information of the API. You can use the Action element in RAM policy statements to grant RAM users or RAM roles the permission to call this API. Details are as follows:
-
Operation: the specific permission point.
-
Access level: the access level of each operation. Valid values: Write, Read, or List.
-
Resource type: the resource types supported for authorization in the operation. Details are as follows:
- For required resource types, an asterisk (*) is added before them.
- For operations that do not support resource-level authorization, All Resources is used.
-
Condition key: the condition keys defined by the cloud service itself.
-
Dependent operation: other permissions required to successfully perform the operation. The operator must have the permissions of the dependent operations for the operation to succeed.
| Operation | Access level | Resource type | Condition key | Dependent operation |
|---|---|---|---|---|
| sfm:CreatePromptTemplate | create | *All Resources * |
| None |
Endpoint
/{workspaceId}/promptTemplatesPath parameters
workspaceIdstringRequiredWorkspace ID.
Request body
namestringRequiredTemplate name.
contentstringRequiredPrompt template content.
Response fields
Schema of Response
promptTemplateIdstringPrompt template ID.
requestIdstringRequest ID.
Response example
Success response
JSON format
{
"promptTemplateId": "6e49109bfeb94a39bb268f4e483ccxxx",
"requestId": "FE9B6CBF-47E6-5D76-9C5D-B814DD5ABxxx\n"
}
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | PromptTemplate.ContentInvalid | Input parameter Content is invalid. | The format of the input parameter Content is invalid. |
| 400 | PromptTemplate.NameInvalid | Input parameter Name is invalid. | The format of the input parameter Name is invalid. |
| 500 | PromptTemplate.InternalError | Prompt template service inner exception. | Internal error of the prompt template service. |
Visit Error Center for more error codes.