You can use this API request to close down a node (Questions Only). You cannot edit a closed node any further unless you reopen it.
/services/v2/node/[nodeId]/close.json
You can use the following parameters in your close a node request:
Specific: prompt, lock
Other options: wrap
Permissions & Notes:
You must have the Close any question permission under Other Standard Roles in the Advanced Editor to close any node.
- If the node is your own, you must have the Close own question permission under Other Standard Roles in the Advanced Editor.
Use the mandatory request parameter prompt to specify the reason why the node is being closed.
Use the optional request parameter lock to specify if you want the node's comments locked. Values are either true or false. The default value is false.
We added this request in version 1.6.3.
Sample Request
A PUT close a node request to close a node (nodeId: 832) because "Question has been answered" 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/832/close.json?prompt=Question has been answered" -v
Expected Response
Successful Response:
- HTTP Status 200 - OK
{
"success": true,
"result": {
"closeAction": {
"id": 1094,
"ip": "172.18.0.3",
"user": {
"id": 108,
"username": "admin",
"avatarUrl": "https://secure.gravatar.com/avatar/4e955c70eeff0abe1974c9be300a8887?d=identicon&r=PG"
},
"actionDate": "Thu Feb 07 15:05:50 UTC 2019",
"canceled": false,
"extra": "Question has been answered",
"private": false,
"verb": "closed",
"node": {
"id": 832,
"type": "question"
}
}
}
}