You can use this API request to make a node a favorite.
The system tracks favorites on a per-user basis, with each user having a separate set of nodes marked as favorites.
The system automatically extracts the identity of the user, making the node a favorite from the credentials used to authenticate the request.
/services/v2/node/[nodeId]/markfavorite.json
You can use the following parameters in your make a node a favorite request:
Other options: wrap
Permissions & Notes:
You must have the View the question page permission under Anonymous Roles in the Advanced Editor.
You must also have the Mark as favorite permission under Standard Roles in the Advanced Editor.
We added this request in version 1.6.3.
Sample Request
A PUT make a node a favorite request to make a node (nodeId: 544) a favorite 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/544/markfavorite.json"
Expected Response
Successful Response:
- HTTP Status 200 - OK
{
"success": true,
"result": {
"favoriteAction": {
"id": 1062,
"ip": "172.20.0.3",
"user": {
"id": 108,
"username": "admin",
"avatarUrl": "https://secure.gravatar.com/avatar/4e955c70eeff0abe1974c9be300a8887?d=identicon&r=PG"
},
"actionDate": "Tue Feb 05 14:19:38 UTC 2019",
"canceled": false,
"extra": null,
"private": false,
"verb": "favorited",
"node": {
"id": 544,
"type": "question"
}
},
"favoriteCount": 1
}
}