Update Collection Grants
put
/mobile/tools/1.0/collections/{id}/grants
Updates a storage collection's access permissions and associated roles. All current grants are deleted and replaced with those specified in this request.
Request
Supported Media Types
- application/json
Path Parameters
- id
-
Type:
string
Required:true
The identifier of the storage collection.
Header Parameters
- If-Match
-
Type:
string
The request completes successfully only if the ETag of the corresponding asset matches the value of this HTTP request header. To force overwrite, pass the value `*`.
Body Parameter
Storage collection grants.
Root Schema : storageCollectionGrants
Type:
object
Storage collection grants.
- grants
-
Type:
array
storageCollectionGrantArrayRequired:true
Additional Properties Allowed:Minimum Number of Items:0
An array of storage collection grants.
Nested Schema : storageCollectionGrantArray
Type:
array
Minimum Number of Items:
0
An array of storage collection grants.
-
Type:
object
storageCollectionGrantAdditional Properties Allowed:Access permission and the roles that are granted that permission.
Nested Schema : storageCollectionGrant
Type:
object
Access permission and the roles that are granted that permission.
- action
-
Type:
string
Required:true
The type of access that is granted to members who have one or more of the specified roles. The valid values areREAD
andREAD_WRITE
. - roles
-
Type:
array
stringArrayRequired:true
Additional Properties Allowed:Minimum Number of Items:0
An array of string values.
Nested Schema : stringArray
Response
Supported Media Types
- application/json
204 Response
Grants were updated. No content was returned in this response.
400 Response
Grants were not updated due to an incorrect request.
Body
Root Schema : error
Type:
object
- detail
-
Type:
string
Required:true
Message that provides the error details. - o:ecid
-
Type:
string
Required:true
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
-
Type:
string
Required:true
The service's error code. - o:errorDetails
-
Type:
object
errorDetailsAdditional Properties Allowed: - o:errorPath
-
Type:
string
Required:true
The relative point in the API path where the error occurred. - status
-
Type:
integer
(int64
)Required:true
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details. - title
-
Type:
string
Required:true
Summary of the problem. - type
-
Type:
string
Required:true
The URI to the link that provides details about the HTTP status code.
Nested Schema : errorDetails
Type:
object
- detail
-
Type:
string
Required:true
- o:errorDetails
-
Type:
object
errorDetailsAdditional Properties Allowed: - title
-
Type:
string
Required:true
Summary of the problem. - type
-
Type:
string
Required:true
The URI to the link that provides details about the HTTP status code.
412 Response
The operation failed based on the `If-Match` condition. Typically, this is the result of concurrent modification detection. It also can be the result of improper values specified in the request headers.
Body
Root Schema : error
Type:
object
- detail
-
Type:
string
Required:true
Message that provides the error details. - o:ecid
-
Type:
string
Required:true
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
-
Type:
string
Required:true
The service's error code. - o:errorDetails
-
Type:
object
errorDetailsAdditional Properties Allowed: - o:errorPath
-
Type:
string
Required:true
The relative point in the API path where the error occurred. - status
-
Type:
integer
(int64
)Required:true
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details. - title
-
Type:
string
Required:true
Summary of the problem. - type
-
Type:
string
Required:true
The URI to the link that provides details about the HTTP status code.
Nested Schema : errorDetails
Type:
object
- detail
-
Type:
string
Required:true
- o:errorDetails
-
Type:
object
errorDetailsAdditional Properties Allowed: - title
-
Type:
string
Required:true
Summary of the problem. - type
-
Type:
string
Required:true
The URI to the link that provides details about the HTTP status code.
Examples
The following example shows how to update a collection???s grants using cURL. For more information about cURL, see Use cURL.
curl -i -X PUT -d @body.json -H "Content-Type: application/json; charset=utf-8" -H "Authorization: Bearer $TOKEN" "$BASE_URL/mobile/tools/1.0/collections/0d1327c9-ef64-4a3f-a685-1d413cc68797/grants"
Example of Request Body
The following shows an example of the request body. This request removes all previous grants for all actions, and adds the grants specified in the body.
{ "grants": [ { "action": "READ", "roles": [ "customer" ] } ] }
Example of Response Header
The following shows an example of the response headers:
204 NO CONTENT Date: Wed, 28 Jun 2017 20:00:11 GMT Etag: "5"