Find User Consent's

get

/oam/services/rest/consent

The REST API enables Administrator to fetch consents related to a User. The API return's all the consents for a given User or specific consents for a given User, OAuth Client and OAuth Application combination.

Request

Supported Media Types
Query Parameters
Header Parameters
Back to Top

Response

Supported Media Types

200 Response

Sucessfully retrieved user consent - detail
Body ()
Root Schema : consent
Type: array
Array of user consent
Show Source

400 Response

Failed to retrieve user consent - detail
Body ()
Back to Top

Examples

The following example shows a sample request and response to fetch all the consents for a specific user, under an OAuth Identity Domain Name.

cURL Example to Fetch All the Consents

curl --location --request GET 'https://<AdminServerHost:AdminServerPort>/oam/services/rest/consent?userId=DemoUser' \
--header 'X-OAUTH-IDENTITY-DOMAIN-NAME: DemoDomain' \
--header 'Authorization: Basic d2VibG9naWM6d2VsY29tZTE=' 

Sample Response

{
    "consents": [
        {
            "clientId": "DemoClient",
            "consentId": "ebe683b9-0345-3c35-a21d-35e57958ed21",
            "createTimeStamp": "Wed Apr 08 22:12:15 PDT 2020",
            "resourceId": "506a50c2-a892-49ee-85ad-9993169a18bf",
            "scopes": [
                "DemoResource.editDemoRes",
                "DemoResource.delDemoRes",
                "DemoResource.viewDemoRes"
            ],
            "valid": true
        },
        {
            "clientId": "DemoClient",
            "consentId": "8c1d5d3a-dc74-3939-aa72-03c12fcff3b3",
            "createTimeStamp": "Wed Apr 08 22:12:15 PDT 2020",
            "resourceId": "OPENID_MGMT_RESOURCE",
            "scopes": [
                "openid",
                "profile",
                "email"
            ],
            "valid": true
        }
    ]
}

The following example shows a sample request and response to fetch consents for each user and client-application.

cURL Command to Fetch Consents for Each User and Client-Application

curl --location --request GET 'https://<AdminServerHost:AdminServerPort>/oam/services/rest/consent?userId=DemoUser&clientIdentifier=DemoClient&resServerId=506a50c2-a892-49ee-85ad-9993169a18bf' \
--header 'X-OAUTH-IDENTITY-DOMAIN-NAME: DemoDomain' \
--header 'Authorization: Basic d2VibG9naWM6d2VsY29tZTE='

Sample Response

{
    "consents": [
        {
            "clientId": "DemoClient",
            "consentId": "ebe683b9-0345-3c35-a21d-35e57958ed21",
            "createTimeStamp": "Wed Apr 08 22:12:15 PDT 2020",
            "resourceId": "506a50c2-a892-49ee-85ad-9993169a18bf",
            "scopes": [
                "DemoResource.editDemoRes",
                "DemoResource.delDemoRes",
                "DemoResource.viewDemoRes"
            ],
            "valid": true
        }
    ]
}
Back to Top