Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

Modify named token

PATCH /tokens/named/{id}

Modifies a specific named token. Supports renaming the token, toggling the revoked flag and modifying the metadata.

This operation is available for the token owner (subject), or (in case of provider tokens) cluster member with cluster_update privilege. Otherwise requires oz_tokens_manage admin privilege.

You can learn more about named and temporary tokens here.

Example cURL requests

Modify named token

curl -u username:password -H "Content-type: application/json" \
-X PATCH -d '{"revoked": true}' \
https://$HOST/api/v3/onezone/tokens/named/$TOKEN_ID

Path parameters

Parameter Type & Description
id required
string

Token Id

Request body

application/json

Named token update request

PropertyType & Description
name
string (TokenPropertyName)

Token name (unique for subject user/provider)

customMetadata
object (TokenPropertyCustomMetadata)

Arbitrary user metadata (JSON) attached to the token

revoked
boolean (TokenPropertyRevoked)

Determines if this token is revoked (cannot be used) - can be toggled at will

Request Examples

application/json
{
  "name": "My secret Token",
  "customMetadata": {
    "jobName": "experiment-15",
    "vm": "worker156.cloud.local"
  },
  "revoked": true
}

Responses

application/json
204

Named token has been updated successfully.

400

Invalid request.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}
401

Authentication error.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}
403

Authorization error.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}
404

Resource not found.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}
500

Internal server Error.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}