Patch accessprofile

Hi All,

Facing error in updating accessprofile with entitlements and governance group using PATCH API
v2024/access-profiles/{id
I am using python script for this.

Can someone help with their insights?

Error: Access profile update failed. Status code: 415 {“timestamp”:“2025-06-18T13:22:13.596+00:00”,“status”:415,“error”:“Unsupported Media Type”,“path”:“/access-profiles/eab146821c1146948f4aa691502cf502”}

    payload = json.dumps({
    "op": "add",
    "path": "/entitlements/0",
    "value": {
        "id": get_entitlement_id(entitlement_name, env_var),
        "type": "ENTITLEMENT",
        "name": "testgroup"
    },
     "owner": {
     "type": "IDENTITY",
     "id": "XXXXX"
    },
     "source": {
      "id": "XXX"
        "type": "SOURCE"
     },
    "requestable": True,
    "accessRequestConfig": {
       "commentsRequired": True,
      "denialCommentsRequired": True,
       "approvalSchemes": [
         {
             "approverType": "MANAGER"
        },
          {
             "approverType": "GOVERNANCE_GROUP",
               "approverId": "XXXX"
         }
     ]
   }
})

Hi @nidhipriya ,

Sorry, I did not face this error previously, so I dont have anythign from the top of my head. However, if I were you, I would try the following:

  • Did this work from postman? If yes, could you please share the request?
  • Did the script work on a different api version?

Hi @vbdm - same error from postman as well
is my payload and path for the entitlement is correct?

Can you please share your postman call and the response?

hi @nidhipriya, based on the input and the error messages these are my observations

  1. Error says Unsupported Media Type: Can you validate if you are passing the correct header values when you are making the request both from postman and from your script.
  2. Since the access profile is already created with the particular source you do not need to again pass source, owner inside value json.
    Can you correct this and try again in postman to see it is working

sounds like you are passing the wrong headers with your request.


Error: Access profile update failed. Status code: 400 {“messages”:[{“localeOrigin”:“REQUEST”,“text”:“The request could not be parsed.”,“locale”:“en-US”},{“localeOrigin”:“DEFAULT”,“text”:“The request could not be parsed.”,“locale”:“en-US”}],“detailCode”:“400.0 Bad request syntax”,“trackingId”:“a184503d69814c6d99e5a0a9f4ee5903”}
tried with different header still getting error msg as above

Hello,

Your payload should be like this:

payload = json.dumps([
  {
    "op": "add",
    "path": "/entitlements/0",
    "value": {
      "id": get_entitlement_id(entitlement_name, env_var),
      "type": "ENTITLEMENT"
    }
  }
])

There is no need to pass any additional information, as the Access Profile ID will be referenced in the URL.

If you want to edit more than one data your payload should be like this:

payload = json.dumps([
  {
    "op": "add",
    "path": "/entitlements/0",
    "value": {
      "id": get_entitlement_id(entitlement_name, env_var),
      "type": "ENTITLEMENT"
    }
  },
  {
    "op": "replace",
    "path": "/accessRequestConfig",
    "value": {
      "commentsRequired": True,
      "denialCommentsRequired": True,
      "approvalSchemes": [
        {
          "approverType": "GOVERNANCE_GROUP",
          "approverId": f"{group_id}"
        }
      ]
    }
  }
])

Other options:

payload = json.dumps([
  {
    "op": "replace",
    "path": "/name",
    "value": "Debug Add Entitlement"
  },
  {
    "op": "replace",
    "path": "/description",
    "value": "Debug Add Entitlement"
  },
  {
    "op": "replace",
    "path": "/owner",
    "value": {
      "type": "IDENTITY",
      "id": "12321321",
      "name": "Yan Coelho"
    }
  },
  {
    "op": "replace",
    "path": "/enabled",
    "value": False
  },
  {
    "op": "replace",
    "path": "/requestable",
    "value": True
  },
  {
    "op": "replace",
    "path": "/accessRequestConfig",
    "value": {
      "commentsRequired": True,
      "denialCommentsRequired": True,
      "approvalSchemes": [
        {
          "approverType": "GOVERNANCE_GROUP",
          "approverId": f"{group_id}"
        }
      ]
    }
  },
  {
    "op": "replace",
    "path": "/revocationRequestConfig",
    "value": {
      "approvalSchemes": []
    }
  },
  {
    "op": "replace",
    "path": "/entitlements",
    "value": []
  },
  {
    "op": "replace",
    "path": "/provisioningCriteria",
    "value": None
  }
])

Thanks

[quote=“Yan Coelho, post:8, topic:145754, username:YanCoelho”]

[
        {
          "approverType": "GOVERNANCE_GROUP",
          "approverId": f"{group_id}"
        }
      ]

@YanCoelho - thank you so much, it worked
:slightly_smiling_face:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.