You can use this API request to delete a node.
The system does not actually remove deleted nodes from the database. The system simply marks them as deleted (equivalent to moving the node to the recycle bin or trash on your computer).
The system does not commonly display nodes in this deleted state in the GUI, though you can still retrieve and update them with an API request.
/services/v2/node/[nodeId]/delete.json
You can use the following parameters in your delete a node request:
Other options: wrap
Permissions & Notes:
- You must have the Delete any question or Delete any question/answer/comment permission to delete any node.
- If the node is your own, you must have the Delete own question or Delete own question/answer/comment permission.
Important! - If you have the Polling Feature enabled and you delete a question node, then you will also delete the survey attached to that question node.
- We added this request in version 1.6.3.
Sample Request
A PUT delete a node request to delete a node (nodeId: 832) 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/delete.json"
Expected Responses
Successful Response:
- HTTP Status 200 - OK
{
"success": true,
"result": {
"deleteAction": {
"id": 1081,
"ip": "172.18.0.3",
"user": {
"id": 108,
"username": "admin",
"avatarUrl": "https://secure.gravatar.com/avatar/4e955c70eeff0abe1974c9be300a8887?d=identicon&r=PG"
},
"actionDate": "Wed Feb 06 19:54:40 UTC 2019",
"canceled": false,
"extra": null,
"private": false,
"verb": "deleted",
"node": {
"id": 832,
"type": "question"
}
}
}
}
Error Response:
If you see a 200 - OK but get a response body of an HTML page, that means that you don't have the required permissions explicitly granted.