

# GetWorkUnits


Retrieves the work units generated by the `StartQueryPlanning` operation.

## Request Syntax


```
POST /GetWorkUnits HTTP/1.1
Content-type: application/json

{
   "NextToken": "string",
   "PageSize": number,
   "QueryId": "string"
}
```

## URI Request Parameters


The request does not use any URI parameters.

## Request Body


The request accepts the following data in JSON format.

 ** [NextToken](#API_GetWorkUnits_RequestSyntax) **   <a name="lakeformation-GetWorkUnits-request-NextToken"></a>
A continuation token, if this is a continuation call.  
Type: String  
Required: No

 ** [PageSize](#API_GetWorkUnits_RequestSyntax) **   <a name="lakeformation-GetWorkUnits-request-PageSize"></a>
The size of each page to get in the AWS service call. This does not affect the number of items returned in the command's output. Setting a smaller page size results in more calls to the AWS service, retrieving fewer items in each call. This can help prevent the AWS service calls from timing out.  
Type: Integer  
Required: No

 ** [QueryId](#API_GetWorkUnits_RequestSyntax) **   <a name="lakeformation-GetWorkUnits-request-QueryId"></a>
The ID of the plan query operation.  
Type: String  
Length Constraints: Fixed length of 36.  
Required: Yes

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "NextToken": "string",
   "QueryId": "string",
   "WorkUnitRanges": [ 
      { 
         "WorkUnitIdMax": number,
         "WorkUnitIdMin": number,
         "WorkUnitToken": "string"
      }
   ]
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [NextToken](#API_GetWorkUnits_ResponseSyntax) **   <a name="lakeformation-GetWorkUnits-response-NextToken"></a>
A continuation token for paginating the returned list of tokens, returned if the current segment of the list is not the last.  
Type: String

 ** [QueryId](#API_GetWorkUnits_ResponseSyntax) **   <a name="lakeformation-GetWorkUnits-response-QueryId"></a>
The ID of the plan query operation.  
Type: String

 ** [WorkUnitRanges](#API_GetWorkUnits_ResponseSyntax) **   <a name="lakeformation-GetWorkUnits-response-WorkUnitRanges"></a>
A `WorkUnitRangeList` object that specifies the valid range of work unit IDs for querying the execution service.  
Type: Array of [WorkUnitRange](API_WorkUnitRange.md) objects

## Errors


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

 ** AccessDeniedException **   
Access to a resource was denied.    
 ** Message **   
A message describing the problem.
HTTP Status Code: 403

 ** ExpiredException **   
Contains details about an error where the query request expired.    
 ** Message **   
A message describing the error.
HTTP Status Code: 410

 ** InternalServiceException **   
An internal service error occurred.    
 ** Message **   
A message describing the problem.
HTTP Status Code: 500

 ** InvalidInputException **   
The input provided was not valid.    
 ** Message **   
A message describing the problem.
HTTP Status Code: 400

 ** WorkUnitsNotReadyYetException **   
Contains details about an error related to work units not being ready.    
 ** Message **   
A message describing the error.
HTTP Status Code: 420

## See Also


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/lakeformation-2017-03-31/GetWorkUnits) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/lakeformation-2017-03-31/GetWorkUnits) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/lakeformation-2017-03-31/GetWorkUnits) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/lakeformation-2017-03-31/GetWorkUnits) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/lakeformation-2017-03-31/GetWorkUnits) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/lakeformation-2017-03-31/GetWorkUnits) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/lakeformation-2017-03-31/GetWorkUnits) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/lakeformation-2017-03-31/GetWorkUnits) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/lakeformation-2017-03-31/GetWorkUnits) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/lakeformation-2017-03-31/GetWorkUnits) 