Creation of policy set using rest api fails

This topic has 2 replies, 2 voices, and was last updated 6 years, 4 months ago by akradhak.

  • Author
  • #8296

    I am trying to create resource type, policy set and policy using rest api..Creation of resource type is successful, but the policy set creation fails.

    creation of resource type :
    curl –header “iPlanetDirectoryPro: AQIC..*” –request POST –header “Content-Type: application/json” –data @resource.json http://<openam-domain&gt;:8080/openam/json/sample/resourcetypes/?_action=create

    Output :


    The uuid output from above, is passed on to “resourceTypeUuids” during policy set creation rest call and I am getting the below error

    curl –request POST –header “iPlanetDirectoryPro: AQIC5wM2LY4SfcyEJTrjCPYbNUg3HpcO9lQNI39jGgZVG3c.*AAJTSQACMDEAAlNLABMzMjAwMTYzMjQ1OTIwODg2MTcyAAJTMQAA*” –header “Content-Type: application/json” –data @policyset.json

    {“code”:400,”reason”:”Bad Request”,”message”:”Invalid resource type 05ab0cb4-4f2b-4649-8a53-91ca84532f3e.”}

    I am not sure why there is “.” appended at the end of the uuid in the above error and my policy.json looks like below :

    cat policyset.json
    “name”: “OAuth2”,
    “resourceTypeUuids”: [
    “realm”: “sample”,
    “conditions”: [
    “applicationType”: “iPlanetAMWebAgentService”,
    “description”: “OAuth2”,
    “resourceComparator”: “com.sun.identity.entitlement.URLResourceName”,
    “subjects”: [
    “entitlementCombiner”: “DenyOverride”,
    “saveIndex”: null,
    “searchIndex”: null,
    “attributeNames”: []

    When I query for the resource type with uuid – 05ab0cb4-4f2b-4649-8a53-91ca84532f3e using rest api call, it results in a valid resource type.. SO not sure why policy set creation fails..Appreciate your help in advance.

    I am also trying to figure out an ssoadm command to create resource type.

    • This topic was modified 6 years, 5 months ago by Peter Major.
     Peter Major

    These work for me just fine:

    curl -X POST -H "Content-Type: application/json" -H "iplanetDirectoryPro: {{adminToken}}" -d '{
       "patterns": [
    }' ""

    and then extract resourceTypeUuid from the response and run:

    curl -X POST -H "Content-Type: application/json" -H "iplanetDirectoryPro: {{adminToken}}" -d '{
       "description":"My personal application",
       "resourceTypeUuids" : ["{{resourceTypeUuid}}"],
    }' ""

    Thanks Peter. I was trying to create policy sets and policies under a realm. Hence the above command didn’t work.. After I gave the realm under the uri, it created the policy set and policies under the realm

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?