Return a List of Collections

get

/mobile/platform/storage/collections

This operation returns a list of the collections that are available through the backend that this request is associated with.

Example

curl -X GET {AUTHENTICATION HEADERS} {HOST}/mobile/platform/storage/collections

Permissions

This operation can be performed anonymously or by a user with a role that's associated with the backend.

Request

Query Parameters
  • 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"
            }
        ]
    }
    
  • 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"
            },
            ...
        ]
    }
    
  • When this query parameter is present with a value of true, then the HTTP response contains the totalResults 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" : [
            ...
        ]
    }
    
Header Parameters
  • 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
  • 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

Supported Media Types

200 Response

OK

The list of collections was retrieved successfully.

Headers
Body ()
Root Schema : Collection Array
Type: object
Title: Collection Array
Show Source
  • Minimum Value: 0
    The number of items returned.
  • 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`.
  • 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
    Minimum Number of Items: 0
    Maximum Number of Items: 100
    Each item represents a collection available in this request context.
  • 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
  • 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.
  • 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
    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`.
Nested Schema : etags
Type: array
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`.
Show Source
Nested Schema : items
Type: array
Minimum Number of Items: 0
Maximum Number of Items: 100
Each item represents a collection available in this request context.
Show Source
Nested Schema : uris
Type: array
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`.
Show Source
Nested Schema : Collection
Type: object
Title: Collection
Show Source
  • Minimum Value: 0
    The total size in bytes of the objects in this collection.
  • Maximum Length: 100
    A description of the collection.
  • 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").
  • 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
  • Flag indicating if the objects are isolated by user.
Example Response (application/json)
{
    "offset":0,
    "hasMore":false,
    "limit":100,
    "count":2,
    "links":[
        {
            "rel":"canonical",
            "href":"/mobile/platform/storage/collections/"
        },
        {
            "rel":"self",
            "href":"/mobile/platform/storage/collections?offset=0&limit=100"
        }
    ],
    "items":[
        {
            "description":"Application logs.",
            "contentLength":0,
            "eTag":"\"1.0\"",
            "links":[
                {
                    "rel":"canonical",
                    "href":"/mobile/platform/storage/collections/logs"
                },
                {
                    "rel":"self",
                    "href":"/mobile/platform/storage/collections/logs"
                }
            ],
            "id":"logs"
        },
        {
            "description":"Application images.",
            "contentLength":6205619,
            "eTag":"\"1.0\"",
            "links":[
                {
                    "rel":"canonical",
                    "href":"/mobile/platform/storage/collections/images"
                },
                {
                    "rel":"self",
                    "href":"/mobile/platform/storage/collections/images"
                }
            ],
            "id":"pictures"
        }
    ]
}

400 Response

Bad Request

This status is returned if you attempt to:

  1. Make a call without specifying the Oracle-Mobile-Backend-ID HTTP request header.
  2. Specify the user query parameter for an endpoint that isn't an object level operation for an isolated collection.
  3. Specify an incorrect value for a query parameter.
  4. Store an object with an identifier longer than the maximum allowed size.
  5. Store an object where the actual size of the object is different from what was specified in the Content-Length HTTP request header.
Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by the service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source

401 Response

Unauthorized

The user is not authenticated. The request must be made with the Authorization HTTP request header.

Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by the service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source

403 Response

Forbidden

This status is returned if you attempt to:

  1. Make a request with a user who doesn't have a role that's associated with the backend.
  2. Retrieve an object without being assigned a role that has READ or READ_WRITE access for a non-anonymous collection.
  3. Retrieve an object from your isolated space without being assigned a role that has READ, READ_WRITE, READ_ALL, or READ_WRITE_ALL access for the collection.
  4. Retrieve an object from another user's isolated space without being assigned a role that has READ_ALL or READ_WRITE_ALL access for the collection.
  5. Store an object without being assigned a role that has been granted READ_WRITE access for a non-anonymous collection.
  6. Store an object to your isolated space without being assigned a role that has READ_WRITE or READ_WRITE_ALL access for the collection.
  7. Store an object to another user's isolated space without being assigned a role that has READ_WRITE_ALL access for the collection.
Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by the service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source

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.

Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by the service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source

Examples

This 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

Here's 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

This 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"
    }
  ]
}