Skip to end of metadata
Go to start of metadata

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

All you need to do is to:

  • Drop the client library into you code,
  • Create an instance of "ApstrataClientAndroid" 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 Android Apstrata SDK source code. The source code ships with a test application. Note that you need to install the Android SDK.

Click here to download the Android Apstrata SDK jar file and required complementary libraries.

The Android Apstrata Client provides the following methods:

MethodDescriptionParametersReturned value
callAPIInvokes an Apstrata api by specifying the api name and parameter. This is the generic serving all-purposes method of the Android client.
  • methodName: the API operation being invoked (example: "SaveUser", "PushNotification", etc.)
  • params: a list of NameValuePair objects representing the text parameters expected by the invoked API operation
  • files: a map representing file parameters that might be expected by the invoked API operation. An entry's key is the parameter name, and the value is a list of files representing the [multiple] value[s] for this parameter

Optionally, you can specify the expected format of the response (XML - default, or JSON) by sending it along the parameters (RESPONSE_TYPE_PARAM = RESPONSE_TYPE_XML or RESPONSE_TYPE_JSON)

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
callAPIStreamInvokes an Apstrata api. This method is used typically to request apstrata file attachments
  • methodName: identifies the API operationbeing invoked
  • params: a list of NameValuePair objects representing the text parameters expected by the invoked API operation
  • files: a map representing file parameters to be sent to the server along with the request. An entry's key is the parameter name, and the value is a list of files representing the [multiple] value[s] for this parameter
  • httpClient: an AndroidHttpClient used by the client object. The calling code is expected to close this httpClient upon consuming the stream
An input stream that returns the data sent by Apstrata in response to the call
callAPIFileSimilar to "callAPIStream" but returns a File handle instead of a stream.
  • methodName: identifies the API operation being invoked
  • params: a list of NameValuePair objects representing the text parameters expected by the invoked API operation
  • path: the path to the destination file, where the content of the file attachment will be stored
A handle (File) to the destination file, where the content is stored
getSignedRequestUrlUse this method to retrieve the URL to a file that is uploaded to an Apstrata Store. This is useful for example when using the URL as a link of a page.
  • action: the concerned Apstrata API operation,
  • parameters: a list of NameValuePair objects representing the parameters expected by the invoked API,
  • files: a map representing file parameters to be sent to the server along with the request. An entry's key is the parameter name, and the value is a list of files representing the [multiple] value[s] for this parameter
 

 

 

 

Labels: