Lock a Node

You can use this API request to lock a node. Only the user that locked it can edit that locked node. This is especially useful as concurrency control on wikified nodes.

/services/v2/node/[nodeId]/lock.json?prompt=[data]

You can use the following parameters in your lock a node request:

Specific: prompt
Other options: wrap

🚧

Permissions & Notes:

  • You must have the Lock comments on posts permission under Moderation Roles in the Advanced Editor to lock any node.

    • If the node you are trying to lock is your own, you must have the Lock comments on own posts permission under Moderation Roles in the Advanced Editor.
  • Use the mandatory request parameter prompt to specify the reason why the node is being locked.

  • We added this request in version 1.6.3.

Sample Request

A PUT lock a node request to lock a node's (nodeId: 809) comments with the reasoning "editing not allowed for anyone but author" sent to https://apidocs.cloud.answerhub.com using a human-readable Username/Password (answerhub/test123) would look like this:

curl 
-u answerhub:test123 
-H "Accept: application/json" 
-H "Content-type: application/json" 
-X PUT "https://apidocs.cloud.answerhub.com/services/v2/node/809/lock.json?prompt=editing+not+allowed+for+anyone+but+author" -v

Expected Response

Successful Response:

  • HTTP Status 200 - OK
{
    "success": true,
    "result": {
        "lockAction": {
            "id": 1068,
            "ip": "172.20.0.3",
            "user": {
                "id": 108,
                "username": "admin",
                "avatarUrl": "https://secure.gravatar.com/avatar/4e955c70eeff0abe1974c9be300a8887?d=identicon&r=PG"
            },
            "actionDate": "Wed Feb 06 15:01:00 UTC 2019",
            "canceled": false,
            "extra": "editing not allowed for anyone but author",
            "private": false,
            "verb": "locked",
            "node": {
                "id": 809,
                "type": "kbentry"
            }
        }
    }
}
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!