key.update

Description

update a single key object.  Please see Updating Objects for an overview of how the update method works.

Parameters

key

An key object, as described by the object.describe call.  If a field in the key object is ommitted, no change will be made to that field.  If extra fields are passed, they will be ignored.  The primary identifier must be specified.

Response

An key object, as described by the object.describe call.  This is actual key that was updated.

Examples

This example updates the status of the key created in the key.create example to be active.

A Sample JSON-RPC Key Update Request

{
    "method": "key.update",
    "params": [
        {
            "id": 339,
            "status": "active"
        }
    ],
    "id": 1
}

The JSON-RPC Response

{
    "result": {
        "id": 339,
        "created": "2009-12-04T21:34:46Z",
        "updated": "2009-12-04T21:36:23Z",
        "service_key": "example_service_key",
        "apikey": "example_apikey",
        "username": "example_username",
        "status": "active",
        "rate_limit_ceiling": 0,
        "qps_limit_ceiling": 0,
        "rate_limit_exempt": false,
        "qps_limit_exempt": false,
        "required_referer": "",
        "secret": "",
        "limits": [
            {
                "period": "second",
                "source": "service",
                "ceiling": 2
            },
            {
                "period": "day",
                "source": "service",
                "ceiling": 5000
            }
        ],
        "object_type": "key"
    },
    "error": null,
    "id": 1
}

Permissions Required

The user who owns the key used to authenticate the key.update call must be a member of one of the following roles

  • Administrator
  • Program Manager
  • Community Manager

See authentication.

Errors

In addition to the standard json-rpc errors and authentication errors, key.update may also return these errors:

HTTP Status Code JSON-RPC Code Error Message Description
400 1000 Invalid Object The object could not be updated because the object would be invalid.  See Validating Fields for details on the format of this error.
400 1001 Duplicate Object The object could not be updated because a change would cause it to conflict with a different object that already exists.
400 1002 Field "x" is required. The object could not be updated because a primary identifier was not passed to enable finding the object to update.
500 2002 Update Failed The object could not be updated.  This is the error message of last resort for object updates and usually indicates a systems integration failure, invalid internal data, or a transient issue.  These errors are logged by Mashery.
403 4200 This operation is not allowed for the service specified The service specified does not allow key updates via the API.
400 5000 Object "type" with "key" of "value" could not be found The object could not be updated because it could not be found.

Docs Navigation