- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateCaseCommand
If you provide a value for PerformedBy.UserArn
you must also have connect:DescribeUser permission on the User ARN resource that you provide
Creates a case in the specified Cases domain. Case system and custom fields are taken as an array id/value pairs with a declared data types.
The following fields are required when creating a case:
-
customer_id
- You must provide the full customer profile ARN in this format:arn:aws:profile:your_AWS_Region:your_AWS_account ID:domains/your_profiles_domain_name/profiles/profile_ID
-
title
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { ConnectCasesClient, CreateCaseCommand } from "@aws-sdk/client-connectcases"; // ES Modules import
// const { ConnectCasesClient, CreateCaseCommand } = require("@aws-sdk/client-connectcases"); // CommonJS import
const client = new ConnectCasesClient(config);
const input = { // CreateCaseRequest
domainId: "STRING_VALUE", // required
templateId: "STRING_VALUE", // required
fields: [ // FieldValueList // required
{ // FieldValue
id: "STRING_VALUE", // required
value: { // FieldValueUnion Union: only one key present
stringValue: "STRING_VALUE",
doubleValue: Number("double"),
booleanValue: true || false,
emptyValue: {},
userArnValue: "STRING_VALUE",
},
},
],
clientToken: "STRING_VALUE",
performedBy: { // UserUnion Union: only one key present
userArn: "STRING_VALUE",
},
};
const command = new CreateCaseCommand(input);
const response = await client.send(command);
// { // CreateCaseResponse
// caseId: "STRING_VALUE", // required
// caseArn: "STRING_VALUE", // required
// };
CreateCaseCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
domainId Required | string | undefined | The unique identifier of the Cases domain. |
fields Required | FieldValue[] | undefined | An array of objects with field ID (matching ListFields/DescribeField) and value union data. |
templateId Required | string | undefined | A unique identifier of a template. |
clientToken | string | undefined | A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs . |
performedBy | UserUnion | undefined | Represents the identity of the person who performed the action. |
CreateCaseCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
caseArn Required | string | undefined | The Amazon Resource Name (ARN) of the case. |
caseId Required | string | undefined | A unique identifier of the case. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | You do not have sufficient access to perform this action. |
ConflictException | client | The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details. |
InternalServerException | server | We couldn't process your request because of an issue with the server. Try again later. |
ResourceNotFoundException | client | We couldn't find the requested resource. Check that your resources exists and were created in the same Amazon Web Services Region as your request, and try your request again. |
ThrottlingException | client | The rate has been exceeded for this API. Please try again after a few minutes. |
ValidationException | client | The request isn't valid. Check the syntax and try again. |
ConnectCasesServiceException | Base exception class for all service exceptions from ConnectCases service. |