AWSS3GetObject

Typecommand
Dictionarylibrary.aws
LibraryAmazon Web Services
Syntax
AWSS3GetObject <pBucket>,<pObject>,<pParameters>,<pFile>,<pCallback>
Associationscom.livecode.library.aws
Summary

Get an object

Parameters
NameTypeDescription
pBucket

The name of a bucket

pObject

The name (key) of the object

pParameters

An array containing parameters to include in the request:

  • "response-content-type" (optional string): Sets the Content-Type header of the response.
  • "response-content-language" (optional string): Sets the Content-Language header of the response.
  • "response-expires" (optional string): Sets the Expires header of the response.
  • "response-cache-control" (optional string): ets the Cache-Control header of the response.
  • "response-content-disposition" (optional string): Sets the Content-Disposition header of the response.
  • "response-content-encoding" (optional string): Sets the Content-Encoding header of the response.
pFile

A file path to save the downloaded object directly to. Using this option will avoid having the entire object loaded into memory locally.

pCallback

A command name to be sent on completion with the server reponse.

Example
AWSS3GetObject "mybucket", "myobject",  , "getObjectCallback"
put it into tRequestID

on getObjectCallback pRequestID, pResult, pError
   if pError is empty then
      put pResult into url "binfile:myfile.dat"
   end if
end getObjectCallback
Values
NameTypeDescription
It

A request ID able to be used with tsNetGetStatus while the request is active.

The result

An error message if the request failed.

RelatedFunction: tsNetGetStatus, tsNetRetrHeaders
Library: tsNet
Description

The caller of this command will be sent the callback message on completion with two parameters:

  • the request ID
  • the object data if the pFile parameter was empty.
  • an error message if one occurred

Note: The message is sent before the tsNet connection is closed so it is possible to access the recieved headers using the tsNetRetrHeaders function

For futher details about this API see the AWS S3 REST API Documentation

Tagsnetworking,networking