BatchGetItem

Description

This function returns the attributes from one or more items from a table or tables. You must use a primary key to identify the items that you want to retrieve.

For more information, see BatchGetItem.

Category

History

ColdFusion (2021 release): Added this function.

Syntax

serviceHandle.batchGetItem(requestParameters)

Parameters

See request parameters of BatchGetItem.

Example

<cfscript> 
  cred={ 
    cred = { 
        "credentialAlias" : "myalias", 
        "vendorName" : "AWS", 
        "region" : "us-east-2", 
        "secretAccessKey" : "xxxxx", 
        "accessKeyId" : "xxxx" 
  } 
  } 
 
  conf={ 
    "serviceName"="DYNAMODB" 
  } 
 
  dynamo=getCloudService(cred, conf) 
  tableName="batchWriteMovie" 
 
  // get items from table 
  batchGetItemStruct={ 
    "RequestItems":{ 
    "#tableName#":{ 
      "Keys":[ 
        { 
          "year":2018, 
          "title":"Solo" 
        }, 
        { 
          "year":2018, 
          "title":"Hereditary" 
        } 
      ] 
    } 
    } 
  } 
  try{ 
    batchGetItemResponse=dynamo.batchGetItem(batchGetItemStruct,{ 
      "customResponse":true 
    }) 
    writeOutput("Items retrieved successfully") 
    writeDump(batchGetItemResponse) 
  } 
  catch(any e){ 
    writeDump(e) 
  } 
</cfscript> 

Get help faster and easier

New user?