Return a List of Collections
/mobile/platform/storage/collections
This operation returns a list of the collections that are available through the mobile backend that this request is associated with.
Example
curl -X GET {AUTHENTICATION HEADERS} {HOST}/mobile/platform/storage/collections
Permissions
Anyone who has access to the backend has access to this operation.
Request
-
limit(optional): number
The maximum number of items to return. If a limit is not specified, or if the requested limit is greater than 100, then 100 is used instead. The response contains the actual limit used, and also a link to get the next set of items (if the total number of items is greater than the limit).
Example - ?limit=10
The following example shows a response to a request that specified a limit of 10 items:
{ "items" : [ ... ], ... "limit": 10, ... "links" : [ ..., { "rel" : "next", "href" : "...?limit=10&offset=10" } ] }
-
offset(optional): number
Specify the index where you want to start browsing the list of items. If you don't specify an offset, then the offset defaults to
0
, which is the first item in the list. The response contains the offset used, and also a link to get the previous set of items.Example - ?offset=200
The following example shows a response to a request that specified an offset of
200
items.{ "items" : [ ... ], ... "offset": 200, ... "links" : [ ..., { "rel" : "prev", "href" : "...?limit=100&offset=100" }, ... ] }
-
totalResults(optional): boolean
When this query parameter is present with a value of
true
, then the HTTP response contains thetotalResults
attribute with a value that represents the total number of items in the collection. By default, the response does not contain this value.Example - ?totalResults=true
{ "items" : [ ... ], ... "totalResults" : 123, ... "links" : [ ... ] }
-
Accept(optional): string
The media types that the client prefers for the response body. If the service doesn't support any of these types, then it returns a
406
status code, and the response body lists the media types that it supports.Examples
*/*
application/*
application/json
application/xml,application/json
-
Oracle-Mobile-Sync-Agent(optional): boolean
When this header is present in the request, and has a value of
true
, then the response contains the information required by the Sync Client SDK to cache the data locally for offline use.
Response
- application/json
200 Response
OK
The list of collections was retrieved successfully.
-
Cache-Control: string
This HTTP response header describes how the result may be cached. The
no-cache
portion ensures that authorization is respected.Cache-Control: public, no-cache
-
Oracle-Mobile-Sync-Resource-Type: string
The Sync Client SDK uses this header.
Allowed Values:[ "collection" ]
object
Collection Array
-
count(optional):
integer
Minimum Value:
0
The number of items returned. -
etags(optional):
array etags
Minimum Number of Items:
0
Maximum Number of Items:100
The ETags that correspond to the returned items. This value is returned only when the request includes the `Oracle-Mobile-Sync-Agent` HTTP request header with a value of `true`. -
hasMore(optional):
boolean
Flag indicating if there are more items to be returned. The value is `true` if there are more items. When `true`, you can use the `next` link to retrieve the next set of items.
-
items(optional):
array items
Minimum Number of Items:
0
Maximum Number of Items:100
Each item represents a collection available in this request context. -
limit(optional):
integer
Minimum Value:
0
Maximum Value:100
The maximum number of items returned. This value (an integer up to `100`) is specified using the `limit` query parameter. -
links(optional):
array links
Minimum Number of Items:
0
The links that you can use to explore the resource. -
offset(optional):
integer
Minimum Value:
0
The index of the first item returned. This is either the value that was specified with the `offset` query parameter or `0` to indicate the first item. -
totalResults(optional):
integer
Minimum Value:
0
The total number of items. This value is returned only when the request includes the query parameter `totalResults` with a value of `true`. -
uris(optional):
array uris
Minimum Number of Items:
0
Maximum Number of Items:100
The canonical links that correspond to the returned items. This value is returned only when the request includes the `Oracle-Mobile-Sync-Agent` HTTP request header with a value of `true`.
array
0
100
-
Array of:
object Collection
Title:
Collection
array
0
-
Array of:
object Link
Title:
Link
array
0
100
object
Collection
-
contentLength(optional):
integer
Minimum Value:
0
The total size in bytes of the objects in this collection. -
description(optional):
string
Maximum Length:
100
A description of the collection. -
eTag(optional):
string
Each collection has an ETag value. This value changes each time the collection metadata is updated. The value includes the starting and ending quotation marks (for example, "2").
-
id(optional):
string
Minimum Length:
1
Maximum Length:100
The collection's name. This is the value that is used in the URI to access the collection. -
links(optional):
array links
Minimum Number of Items:
0
The links that you can use to explore the resource. -
userIsolated(optional):
boolean
Flag indicating if the objects are isolated by user.
array
0
-
Array of:
object Link
Title:
Link
object
Link
-
href:
string
A relative URL.
-
rel:
Allowed Values:
[ "self", "canonical", "prev", "next" ]
The type of link.
{
"hasMore":false,
"limit":100,
"count":2,
"items":[
{
"id":"logs",
"eTag":"\"1.0\"",
"description":"Application logs.",
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/storage/collections/logs"
},
{
"rel":"self",
"href":"/mobile/platform/storage/collections/logs"
}
],
"contentLength":0
},
{
"id":"pictures",
"eTag":"\"1.0\"",
"description":"Application images.",
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/storage/collections/images"
},
{
"rel":"self",
"href":"/mobile/platform/storage/collections/images"
}
],
"contentLength":6205619
}
],
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/storage/collections/"
},
{
"rel":"self",
"href":"/mobile/platform/storage/collections?offset=0&limit=100"
}
],
"offset":0
}
400 Response
Bad Request
This status is returned if you attempt to:
- Make a call without specifying the
Oracle-Mobile-Backend-ID
HTTP request header. - Specify the
user
query parameter for an endpoint that isn't an object level operation for an isolated collection. - Specify an incorrect value for a query parameter.
- Store an object with an identifier longer than the maximum allowed size.
- Store an object where the actual size of the object is different from what was specified in the
Content-Length
HTTP request header.
object
Error
-
detail:
string
Message that provides the error details.
-
o:ecid:
string
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorDetails(optional):
array o:errorDetails
Minimum Number of Items:
0
List of the issues that cause the error. Included when the error is caused by multiple issues. -
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
array
0
-
Array of:
object Error Detail
Title:
Error Detail
object
Error Detail
-
instance:
string
The URI to the link that provides more detailed information about the error.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
401 Response
Unauthorized
The user is not authenticated. The request must be made with the Authorization
HTTP request header.
object
Error
-
detail:
string
Message that provides the error details.
-
o:ecid:
string
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorDetails(optional):
array o:errorDetails
Minimum Number of Items:
0
List of the issues that cause the error. Included when the error is caused by multiple issues. -
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
array
0
-
Array of:
object Error Detail
Title:
Error Detail
object
Error Detail
-
instance:
string
The URI to the link that provides more detailed information about the error.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
403 Response
Forbidden
This status is returned if you attempt to:
- Make a request with a user from a realm that isn't associated with the mobile backend.
- Retrieve an object without being assigned a role that has
READ
orREAD_WRITE
access for the collection. - Retrieve an object from your isolated space without being assigned a role that has
READ
,READ_WRITE
,READ_ALL
, orREAD_WRITE_ALL
access for the collection. - Retrieve an object from another user's isolated space without being assigned a role that has
READ_ALL
orREAD_WRITE_ALL
access for the collection. - Store an object without being assigned a role that has been granted
READ_WRITE
access for the collection. - Store an object to your isolated space without being assigned a role that has
READ_WRITE
orREAD_WRITE_ALL
access for the collection. - Store an object to another user's isolated space without being assigned a role that has
READ_WRITE_ALL
access for the collection.
object
Error
-
detail:
string
Message that provides the error details.
-
o:ecid:
string
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorDetails(optional):
array o:errorDetails
Minimum Number of Items:
0
List of the issues that cause the error. Included when the error is caused by multiple issues. -
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
array
0
-
Array of:
object Error Detail
Title:
Error Detail
object
Error Detail
-
instance:
string
The URI to the link that provides more detailed information about the error.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
406 Response
Not Acceptable
The media type of the resource isn't compatible with the values in the Accept
header.
For example, you see this error when you try to request a resource that has the media type application/json
and the Accept
header value is application/xml
.
object
Error
-
detail:
string
Message that provides the error details.
-
o:ecid:
string
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorDetails(optional):
array o:errorDetails
Minimum Number of Items:
0
List of the issues that cause the error. Included when the error is caused by multiple issues. -
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
array
0
-
Array of:
object Error Detail
Title:
Error Detail
object
Error Detail
-
instance:
string
The URI to the link that provides more detailed information about the error.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
Examples
The following example shows how to use cURL to retrieve a list of collections that are available through the backend by submitting a GET request on the REST resource.
curl -i \
-X GET \
-u mobile.user@example.com:password \
-H "Oracle-Mobile-Backend-ID: ABCD9278-091f-41aa-9cb2-184bd0586fce" \
https://fif.cloud.oracle.com/mobile/platform/storage/collections
Example of Response Header
The following shows an example of the response header:
200 OK
Date: Thu, 29 Mar 2018 21:43:46 GMT
Content-Length: 786
Content-Type: application/json
Example of Response Body
The following example shows the contents of the response body in JSON format:
{
"items": [
{
"id": "incidentImages",
"description": "Images for incidents",
"userIsolated": false,
"contentLength": 51395,
"eTag": "\"1.0\"",
"links": [
{
"rel": "canonical",
"href": "/mobile/platform/storage/collections/incidentImages"
},
{
"rel": "self",
"href": "/mobile/platform/storage/collections/incidentImages"
}
]
},
{
"id": "technicianNotes",
"description": "Technicians' personal notes.",
"userIsolated": true,
"contentLength": 206,
"eTag": "\"1.0\"",
"links": [
{
"rel": "canonical",
"href": "/mobile/platform/storage/collections/technicianNotes"
},
{
"rel": "self",
"href": "/mobile/platform/storage/collections/technicianNotes"
}
]
}
],
"hasMore": false,
"limit": 100,
"offset": 0,
"count": 2,
"links": [
{
"rel": "canonical",
"href": "/mobile/platform/storage/collections/"
},
{
"rel": "self",
"href": "/mobile/platform/storage/collections"
}
]
}