Return Collection Metadata

head

/mobile/platform/storage/collections/{collection}

This operation returns the collection metadata. This operation is similar to the GET operation except that no body is returned. The collection must be available through the mobile backend that the request is associated with.

Example

The following example returns the metadata for the myCollection collection.

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

Permissions

Anyone who has access to the backend has access to this operation.

Request

Path Parameters
  • The name of the collection that you want to access.

    When you look at the metadata for the collection, this parameter corresponds to the id value:

    {
      "id": "pictures",
      "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"
        }
      ]
    }
    
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
  • The request completes successfully only if the ETag of the corresponding item matches one of the values specified in this HTTP request header.

    Example - Optimistic Locking

    Assume that the last time you requested an item, its ETag was "2". You can use the If-Match HTTP request header to ensure that the operation succeeds only if the item wasn't modified after you last requested it.

  • The request completes successfully only if the ETag of the corresponding item does not match one of the values specified by this HTTP request header.

    Example - Get Only if Newer

    You can use this header to reduce the amount of data that gets pulled down to your client. For example, assume that the last time you accessed an item, its ETag was "2". You can use the If-None-Match HTTP request header to ensure that the operation succeeds only if the item has been modified since you last requested it.

    Example - Put if Absent

    When the value of the If-None-Match request header is a wildcard (*), then the request succeeds only when an ETag is not present.

Back to Top

Response

200 Response

OK

The metadata for the specified collection was returned successfully.

Headers
  • Each item has an ETag value. This value changes each time the item is updated. The value includes the starting and ending quotation marks (for example, "2"). You can use an ETag value with the following HTTP request headers:

    • If-Match
    • IF-None-Match

304 Response

Not Modified

This status is returned when an object with the given identifier exists in the specified collection, but the operation failed because of one or more of the following conditions:

  • If-Modified-Since
  • If-None-Match

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.

401 Response

Unauthorized

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

403 Response

Forbidden

This status is returned if you attempt to:

  1. Make a request with a user from a realm that isn't associated with the mobile backend.
  2. Retrieve an object without being assigned a role that has READ or READ_WRITE access for the 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 the 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.

404 Response

Not Found

A collection with the given identifier does not exist.

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.

412 Response

Precondition Failed

This status is returned when the collection with the given identifier exists, but the operation failed because of one or more of the following conditions:

  • If-Match
  • If-None-Match
Back to Top

Examples

This example shows how to use cURL to retrieve header information about a collection by submitting a HEAD request on the REST resource using cURL. Unlike the equivalent GET command, the request does not return a body. You could use this request to check if an object exists or to verify that a subsequent GET with the same header and URI would work.

curl -i \
-X HEAD \ 
-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/technicianNotes

Example of Response Header

Here's an example of the response header:

200 OK
Date: Thu, 29 Mar 2018 21:43:46 GMT
Back to Top