Skip to end of metadata
Go to start of metadata

The iOS Apstrata SDK is a utility that is provided to developers of iOS-based applications. The iOS Apstrata SDK wraps the Apstrata REST APIs making it very easy to call these latter from within Objective C code.

The iOS SDK is provided as source code: an interface "apstrata.h" and an implementation class "apstrata.mm". All you need to do is to add this code to your own and compile it.

  • Drop the client library into you code,
  • Create an instance of "ApstrataiPhoneClient" passing it the URL of the Apstrata server, the key and secret of the Apstrata account you are using and the expected authentication mode (more on authentication with Apstrata).
  • Call one of the methods exposed by the Android client.

Click here to download the iOS Apstrata SDK source code. The source code ships with a sample file.

The iOS Apstrata Client provides the following methods:

MethodDescriptionParametersReturned value
callAPIMethodInvokes an Apstrata api by specifying the api name and parameters. This is the generic serving all-purposes method of the iOS client.
  • methodName: the API operation being invoked (example: "SaveUser", "PushNotification", etc.)
  • params: a dictionary of key/value entries representing the text parameters expected by the invoked API operation
  • files: a dictionary of NamedFileData instances associated to keys (this class is defined in the apstrata.h interface). Each instance of NamedFileData contains the name of the file to upload and the corresponding bytes (NSData). Each key represents a field of the targeted document to which the files will be attached. Note that if the document is schema-less, it is only possible to attach files to a unique field named "apsdb_attachments"
A string representing the response sent by the API
callAPIJsonSimilar to the above except that it returns the response in JSON formatSame as above. You do not need to specify the expected returned format of the response.A string representing the response sent by the API, in JSON format
callAPIXmlSimilar to the above except that it returns the response in XML formatSame as above. You do not need to specify the expected returned format of the response.A string representing the response sent by the API, in XML format
callAPIFileThis method is used typically to download a file
  • methodName: identifies the API operationbeing invoked
  • params: a list of key/value pairs representing the text parameters expected by the invoked API operation
  • path: the local path to a folder where to store the downloaded file. If path is null or empty, the downloaded file is not store an only a pointer to an NSData of the file content is returned
An buffer of bytes (NSData*)
getFullApiUrlUse this method to retrieve the URL of a file attached to a document stored in your account

Same as callAPIMethod.

A string representing the url of the API call (useful to download an attached file)

Examples:

 

Create an instance of the iOS Apstrata client
Create and execute a Query
Save a document with an attached file
Download an attached file (do not store it locally)
Get attached file URL
Labels: