

# StartTask

Starts a task that imports a data dictionary, verified queries, or ontologies into an agent context. The task runs asynchronously and records the changes it makes as change sets. GetTask returns its status.

## Request Parameters
<a name="API_StartTask_RequestParameters"></a>

 ** accessControlConfig **   
Who can see the content that the task adds to the agent context. AWS Context supports only one entry: `ALLOW` with `principalId` `*`, so that every reader of the agent context can see it. If you omit it or send no entries, AWS Context uses that entry. If you name any other principal, include a `DENY` entry, or send more than one entry, the request fails with `ValidationException`, and no task is started.  
Type: [AccessControlConfig](API_AccessControlConfig.md) object  
Required: No

 ** agentContextId **   
The agent context, as an ID or ARN.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 180.  
Pattern: `(arn:(aws|aws-cn|aws-us-gov):context:[a-z0-9\-]{1,32}:\d{12}:agent-context/)?[a-z0-9]+(-[a-z0-9]+)*`   
Required: Yes

 ** clientToken **   
A unique, case-sensitive identifier that you provide to ensure that the request completes no more than one time. The token is scoped to your account and the agent context. If you reuse a token on the same agent context with different parameters, the request fails with `ValidationException`.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[\x21-\x7E]+`   
Required: No

 ** description **   
A description of the task. Up to 1,024 characters, with no control characters.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 1024.  
Pattern: `\P{Cc}*`   
Required: No

 ** inputConfiguration **   
What the task imports. Set exactly one member. The member that you set determines the task's `type`.  
Type: [TaskInputConfiguration](API_TaskInputConfiguration.md) object  
 **Note: **This object is a Union. Only one member of this object can be specified or returned.  
Required: Yes

## Response Elements
<a name="API_StartTask_ResponseElements"></a>

The following elements are returned by the service.

 ** agentContextId **   
The agent context's ID.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 180.  
Pattern: `(arn:(aws|aws-cn|aws-us-gov):context:[a-z0-9\-]{1,32}:\d{12}:agent-context/)?[a-z0-9]+(-[a-z0-9]+)*` 

 ** arn **   
The Amazon Resource Name (ARN) of the task.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `arn:(aws|aws-cn|aws-us-gov):context:[a-z0-9\-]{1,32}:\d{12}:agent-context/[a-z0-9]+(-[a-z0-9]+)*/task/[a-z0-9]+(-[a-z0-9]+)*` 

 ** createdAt **   
The date and time when the task was created.  
Type: Timestamp

 ** description **   
The description of the task, as given to StartTask.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 1024.  
Pattern: `\P{Cc}*` 

 ** id **   
The ID of the task. Pass it as `taskId` to GetTask or CancelTask.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[a-z0-9]+(-[a-z0-9]+)*` 

 ** inputConfiguration **   
A summary of the input that the task was started with. Each document is returned as its name, size, and content type, not its content, and each ontology is returned as its ARN and, if set, its version.  
Type: [TaskInputConfigurationSummary](API_TaskInputConfigurationSummary.md) object  
 **Note: **This object is a Union. Only one member of this object can be specified or returned.

 ** outputs **   
What the task created, in creation order. Set when it finishes.  
Type: Array of [TaskOutput](API_TaskOutput.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 100 items.

 ** statistics **   
Counts of the documents that the task analyzed and the change sets that it created. The counts are final once the task is `COMPLETED`, `FAILED`, or `CANCELLED`.  
Type: [TaskStatistics](API_TaskStatistics.md) object

 ** status **   
The status of the task. A task moves from `PENDING` to `IN_PROGRESS` and ends `COMPLETED`, `FAILED`, or `CANCELLED`. After CancelTask, it is `CANCELLING` until it stops.  
Type: String  
Valid Values: `PENDING | IN_PROGRESS | COMPLETED | FAILED | CANCELLING | CANCELLED` 

 ** statusMessage **   
The reason the task failed. Present only when status is FAILED.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.

 ** statusReasonCode **   
The code for why the task failed. Present only when `status` is `FAILED`.  
Valid values:  
+  `GRAPH_NOT_ACTIVE` - The agent context was deleted, or was not yet available, while the task ran.
+  `ONTOLOGY_INVALID` - An ontology is missing, has no loadable source, or its source is unsafe or too large.
+  `ONTOLOGY_IMPORT_UNAVAILABLE` - An ontology couldn't be imported because of a temporary problem. Start a new task.
+  `ONTOLOGY_ALREADY_IMPORTED` - This ontology version is already imported into the agent context.
Type: String  
Valid Values: `GRAPH_NOT_ACTIVE | ONTOLOGY_INVALID | ONTOLOGY_IMPORT_UNAVAILABLE | ONTOLOGY_ALREADY_IMPORTED` 

 ** type **   
The type of the task. It is set by the `inputConfiguration` member that the task was started with: `IMPORT_DATA_DICTIONARY`, `IMPORT_VERIFIED_QUERIES`, or `IMPORT_ONTOLOGY`.  
Type: String  
Valid Values: `IMPORT_DATA_DICTIONARY | IMPORT_VERIFIED_QUERIES | IMPORT_ONTOLOGY` 

 ** updatedAt **   
The date and time when the task was last updated, such as when its status changed. Equal to `createdAt` until the task first changes.  
Type: Timestamp

## Errors
<a name="API_StartTask_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.    
 ** message **   
A message that describes the error.
HTTP Status Code: 403

 ** ConflictException **   
The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.    
 ** message **   
A message that describes the error.  
 ** resourceId **   
The ID of the resource that caused the conflict. When several resources caused it, a comma-separated list of their IDs.  
 ** resourceType **   
The type of the resource that caused the conflict.  
Valid values:  
+  `agent-context` - An agent context.
+  `connection` - A connection.
+  `curation-policy` - A curation policy.
+  `evaluation` - Reserved for future use.
+  `ontology` - An ontology.
+  `ontology-induction` - An ontology induction.
+  `resource-policy` - A resource-based policy.
HTTP Status Code: 409

 ** InternalServerException **   
The request failed because of an internal error. Retry the request.    
 ** message **   
A message that describes the error.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.    
 ** message **   
A message that describes the error.  
 ** resourceId **   
The ID of the resource that was not found.  
 ** resourceType **   
The type of the resource that wasn't found.  
Valid values:  
+  `agent-context` - An agent context.
+  `connection` - A connection.
+  `curation-policy` - A curation policy.
+  `evaluation` - Reserved for future use.
+  `ontology` - An ontology.
+  `ontology-induction` - An ontology induction.
+  `resource-policy` - A resource-based policy.
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The request would exceed a service quota. Check the quota that `quotaCode` names, reduce your usage, and then retry the request.    
 ** message **   
A message that describes the error.  
 ** quotaCode **   
The code of the quota that the request would exceed.  
 ** resourceId **   
The ID of the resource that the quota applies to.  
 ** resourceType **   
The type of the resource that the quota applies to.  
Valid values:  
+  `agent-context` - An agent context.
+  `connection` - A connection.
+  `curation-policy` - A curation policy.
+  `evaluation` - Reserved for future use.
+  `ontology` - An ontology.
+  `ontology-induction` - An ontology induction.
+  `resource-policy` - A resource-based policy.  
 ** serviceCode **   
The code of the service that owns the quota.
HTTP Status Code: 402

 ** ThrottlingException **   
The request was denied because it exceeded a request rate quota. Wait, then retry the request.    
 ** message **   
A message that describes the error.  
 ** quotaCode **   
The code of the quota that throttled the request.  
 ** retryAfterSeconds **   
The number of seconds to wait before you retry the request, if AWS Context provides one.  
 ** serviceCode **   
The code of the service whose quota throttled the request.
HTTP Status Code: 429

 ** ValidationException **   
The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.    
 ** fieldList **   
The fields that failed validation, each with a message that describes why.  
 ** message **   
A message that describes the error.  
 ** reason **   
The reason that the input failed validation. Valid values:  
+  `unknownOperation` - The operation isn't recognized.
+  `cannotParse` - The request couldn't be parsed.
+  `fieldValidationFailed` - One or more fields failed validation. `fieldList` describes them.
+  `other` - Another reason. `message` describes it.
HTTP Status Code: 400

## See Also
<a name="API_StartTask_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/context-2022-07-26/StartTask) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/context-2022-07-26/StartTask) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/context-2022-07-26/StartTask) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/context-2022-07-26/StartTask) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/context-2022-07-26/StartTask) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/context-2022-07-26/StartTask) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/context-2022-07-26/StartTask) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/context-2022-07-26/StartTask) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/context-2022-07-26/StartTask) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/context-2022-07-26/StartTask) 