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
- Inactive User6 years agoThank 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. - MattV6 years agoKhoros Staffian You can build more complex LiQL calls with this object: https://developer.khoros.com/khoroscommunitydevdocs/reference/restbuilder - Inactive User6 years agoWould 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() />