Forum Discussion
Tarun
6 years agoMaven
Hi Inactive User ,
You can look to use the subscriptions API over here to subscribe/unsubscribe a user to a label:
curl -X POST \
https://[COMMUNITY DOMAIN]/api/2.0/subscriptions \
-H 'content-type: application/json' \
-H 'li-api-session-key: [SESSION KEY]' \
-d '{
"data":{
"type":"subscription",
"target":{
"type":"label",
"id":"Mexico"
},
"board":{
"id":"vacationBlog"
}
}
}'Please Give Kudos if you find this post useful and also mark this as Accepted Solution if this is the required solution.
Regards
Tarun Kumar
Sign in to react to this post
- Inactive User6 years agoNot applicable
Thank you. Any thoughts on how I could create a link on a page with that script? I'm at a loss of where to use curl on a Community page. Component? Endpoint? Is it even valid in freemarker? Etc.
Sign in to react to this post- MattV6 years agoKhoros Staff
ian You can build more complex LiQL calls with this object: https://developer.khoros.com/khoroscommunitydevdocs/reference/restbuilder
Sign in to react to this post- Inactive User6 years agoNot applicable
Would this be correct, then?
<#assign messagePostCall = restBuilder() .method("POST") .path("/subscriptions") .body({ "type": "message", "board": { "id": "board-test" }, "target": { "type":"label", "id": "Jupiter" } }) .admin(true) /> <#assign resp = messagePostCall.call() />Sign in to react to this post