EasyManuals Logo

Amazon AWS SDK User Manual

Amazon AWS SDK
19 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #14 background imageLoading...
Page #14 background image
The Response Object (AWS.Response)
The response object is passed into each callback function so that you can access response data.The
AWS.Response object that is passed in contains two important properties to get at this data:
data
error
When using the standard callback mechanism, the two properties will be made available as parameters
on the callback method in the form: function(error, data) { ... }
The data property
The response.data property contains the serialized object data retrieved from the service request. For
instance, for an Amazon DynamoDB listTables method call, the response data might look like this:
> response.data
{ TableNames:
[ 'table1', 'table2', ... ] }
The data property can be null if an error occurs (see below).
The error property
In the event of a service error (or transfer error), the response.error property will be filled with the
given error data in the form:
{ code: 'SHORT_UNIQUE_ERROR_CODE',
message: 'Some human readable error message' }
In the case of an error, the data property will be null. Note that if you handle events that can be in a
failure state, you should always check whether response.error is set before attempting to access the
response.data property.
The request Property
Access to the originating request object is available through this property. For example, to access the
parameters that were sent with a request:
s3.getObject({Bucket: 'bucket', Key: 'key'}).on('success', function(response)
{
console.log("Key was", response.request.params.Key);
}).send();
Version 0.9.1-pre.2 : Preview
10
AWS SDK for Node.js Getting Started Guide
The Response Object (AWS.Response)

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Amazon AWS SDK and is the answer not in the manual?

Amazon AWS SDK Specifications

General IconGeneral
CategorySoftware Development Kit (SDK)
DeveloperAmazon Web Services (AWS)
LicenseApache License 2.0
PurposeTo enable developers to interact with AWS services from their applications.
Supported LanguagesJava, Python, JavaScript, .NET, Ruby, PHP, Go, C++
Supported AWS ServicesAll AWS services
Operating SystemsWindows, macOS, Linux
Latest VersionVaries by SDK and language. Refer to the official AWS documentation for the specific SDK.
RepositoryGitHub (for many SDKs)
DocumentationAvailable on the AWS website.
SDK FeaturesAPI abstraction, request signing, error handling, retry logic, data serialization, and support for various authentication methods.

Related product manuals