

# GetItem
<a name="API_GetItem_v20111205"></a>

**중요**  
***이 단원에서 언급되는 API 버전 2011-12-05는 사용 중단되었으며 새 애플리케이션에 사용해서는 안 됩니다.***  
 **현재 하위 수준 API에 대한 설명서는 [Amazon DynamoDB API 참조](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/) 섹션을 참조하세요.**

## 설명
<a name="API_GetItem_Description"></a>

`GetItem` 작업은 기본 키와 일치하는 항목에 대한 `Attributes` 세트를 반환합니다. 일치하는 항목이 없으면 `GetItem`이 데이터를 반환하지 않습니다.

`GetItem` 작업은 기본적으로 최종적 일관된 읽기(Eventually Consistent Read)를 제공합니다. 애플리케이션에서 최종적 일관된 읽기(Eventually Consistent Read)를 사용할 수 없는 경우 `ConsistentRead`를 사용하세요. 이 작업은 표준 읽기보다 오래 걸릴 수 있지만 항상 마지막으로 업데이트된 값을 반환합니다. 자세한 내용은 [DynamoDB 읽기 일관성](HowItWorks.ReadConsistency.md) 단원을 참조하십시오.

## 요청
<a name="API_GetItem_RequestParameters"></a>

### 구문
<a name="API_GetItem_RequestParameters.syntax"></a>

```
// This header is abbreviated.
// For a sample of a complete header, see DynamoDB 하위 수준 API.
POST / HTTP/1.1 
x-amz-target: DynamoDB_20111205.GetItem
content-type: application/x-amz-json-1.0 

{"TableName":"Table1",
 	"Key": 
		{"HashKeyElement": {"S":"AttributeValue1"},
		"RangeKeyElement": {"N":"AttributeValue2"} 
	},
	"AttributesToGet":["AttributeName3","AttributeName4"],
	"ConsistentRead":Boolean
}
```


****  

|  명칭  |  설명  |  필수 | 
| --- | --- | --- | 
|  TableName  |  요청된 항목을 포함하는 테이블의 이름입니다. 유형: 문자열  |  예  | 
|  Key  | 항목을 정의하는 기본 키 값입니다. 기본 키에 대한 자세한 내용은 [프라이머리 키](HowItWorks.CoreComponents.md#HowItWorks.CoreComponents.PrimaryKey) 단원을 참조하세요.형식: 해당 값에 대한 `HashKeyElement` 및 해당 값에 대한 `RangeKeyElement`의 맵 | 예 | 
| AttributesToGet  | 속성 이름의 배열입니다. 속성 이름을 지정하지 않으면 모든 속성이 반환됩니다. 일부 속성을 찾을 수 없는 경우 결과에 표시되지 않습니다.유형: 배열 | 아니요 | 
| ConsistentRead  | `true`로 설정하면 consistent read가 발생하고, 그 밖의 경우에는 eventually consistent가 사용됩니다.타입: 부울 | 아니요 | 

## 응답
<a name="API_GetItem_ResponseElements"></a>

### 구문
<a name="API_GetItem_ResponseElements.syntax"></a>

```
HTTP/1.1 200 
x-amzn-RequestId: 8966d095-71e9-11e0-a498-71d736f27375 
content-type: application/x-amz-json-1.0
content-length: 144

{"Item":{
	"AttributeName3":{"S":"AttributeValue3"},
	"AttributeName4":{"N":"AttributeValue4"},
	"AttributeName5":{"B":"dmFsdWU="}
	},
"ConsumedCapacityUnits": 0.5
}
```


****  

|  명칭  |  설명  | 
| --- | --- | 
|  Item  | 요청된 속성을 포함합니다.형식: 속성 이름-값 페어의 맵 | 
| ConsumedCapacityUnits | 작업에 사용된 읽기 용량 단위의 수. 이 값은 할당 처리량에 적용되는 수를 나타냅니다. 존재하지 않는 항목에 대한 요청은 읽기 형식에 따라 최소 읽기 용량 단위를 사용합니다. 자세한 정보는 [DynamoDB 프로비저닝된 용량 모드](provisioned-capacity-mode.md) 섹션을 참조하세요. 형식: 숫자 | 

## 특수 오류
<a name="API_GetItem_SpecialErrors"></a>

이 작업에는 특정 오류가 없습니다.

## 예시
<a name="API_GetItem_Examples"></a>

 AWS SDK를 사용하는 예는 [DynamoDB의 항목 및 속성 작업](WorkingWithItems.md) 단원을 참조하세요.

### 샘플 요청
<a name="API_GetItem_Examples_Request"></a>

```
// This header is abbreviated.
// For a sample of a complete header, see DynamoDB 하위 수준 API.
POST / HTTP/1.1 
x-amz-target: DynamoDB_20111205.GetItem
content-type: application/x-amz-json-1.0 

{"TableName":"comptable",
	"Key":
		{"HashKeyElement":{"S":"Julie"},
		"RangeKeyElement":{"N":"1307654345"}},
	"AttributesToGet":["status","friends"],
	"ConsistentRead":true
}
```

### 샘플 응답
<a name="API_GetItem_Examples_Response"></a>

선택적 파라미터 `ConsistentRead`가 `true`로 설정되었으므로 ConsumedCapacityUnits 값은 1입니다. 같은 요청에 대해 `ConsistentRead`가 `false`로 설정되거나 지정되지 않으면 응답이 eventually consistent이고 ConsumedCapacityUnits 값은 0.5입니다.

```
HTTP/1.1 200 
x-amzn-RequestId: 8966d095-71e9-11e0-a498-71d736f27375 
content-type: application/x-amz-json-1.0
content-length: 72

{"Item":
	{"friends":{"SS":["Lynda, Aaron"]},
	"status":{"S":"online"}
	},
"ConsumedCapacityUnits": 1
}
```