UMA Labels Endpoint for Users

AM provides the /json/users/username/oauth2/resources/labels REST endpoint to let users manage user labels.

Specify the username in the URL, and provide the SSO token of that user in the iPlanetDirectoryPro header.

Use the /json/users/username/oauth2/resources/labels REST endpoint for the following operations:

To Create User Labels by Using REST
  • To create a new user label, create a POST request with the name of the new user label and the type, USER, as shown below:

    $ curl \
    --request POST \
    --header 'Accept-API-Version: resource=1.0' \
    --header "Content-Type: application/json" \
    --header "iPlanetDirectoryPro: AQIC5wM2LY4S...Q4MTE4NTA2*" \
    --data \
    '{
        "name" : "New Resource Label",
        "type" : "USER"
    }' \
    https://openam.example.com:8443/openam/json/realms/root/users/demo/oauth2/resources/labels
         {
        "_id": "db2161c0-167e-4195-a832-92b2f578c96e3",
        "_rev": "-785293115",
        "name": "New Resource Set Label",
        "type": "USER"
    }

    On success, an HTTP 201 Created status code is returned, as well as the unique identifier of the new user label in the _id property in the JSON-formatted body. Note that the user label is not yet associated with a resource. To apply the new label to a resource, see "To Update an UMA Resource".

To Query User Labels by Using REST
  • To query the labels belonging to a user, create a GET request including _queryFilter=true in the query string, as shown below:

    $ curl \
    --header "iPlanetDirectoryPro: AQIC5wM2LY4S...Q4MTE4NTA2*" \
    --header "Accept-API-Version: resource=1.0" \
    https://openam.example.com:8443/json/realms/root/users/demo/oauth2/resources/labels?_queryFilter=true
         {
        "result": [
            {
                "_id": "46a3392f-1d2f-4643-953f-d51ecdf141d44",
                "name": "2015/October/Bristol",
                "type": "USER"
            },
            {
                "_id": "60b785c2-9510-40f5-85e3-9837ac272f1b1",
                "name": "Top Level/Second Level/My Label",
                "type": "USER"
            },
            {
                "_id": "ed5fad66-c873-4b80-93bb-92656eb06deb0",
                "name": "starred",
                "type": "STAR"
            },
            {
                "_id": "db2161c0-167e-4195-a832-92b2f578c96e3",
                "name": "New Resource Set Label",
                "type": "USER"
            }
        ],
        "resultCount": 4,
        "pagedResultsCookie": null,
        "totalPagedResultsPolicy": "NONE",
        "totalPagedResults": -1,
        "remainingPagedResults": -1
    }
To Delete User Labels by using REST
  • To delete a user label belonging to a user, create a DELETE request including the ID of the user label to delete in the URL, as shown below:

    $ curl \
    --request DELETE \
    --header "iPlanetDirectoryPro: AQIC5wM2LY4S...Q4MTE4NTA2*" \
    --header "Accept-API-Version: resource=1.0" \
    https://openam.example.com:8443/json/realms/root/users/demo/oauth2/resources/labels/46a3392f-1d2f-4643-953f-d51ecdf141d44
         {
        "_id": "46a3392f-1d2f-4643-953f-d51ecdf141d44",
        "name": "2015/October/Bristol",
        "type": "USER"
    }

    On success, an HTTP 200 OK status code is returned, as well as a JSON representation of the user label that was removed.

Read a different version of :