I am making a call to get user permission from po...
# permit-saas
t
I am making a call to get user permission from postman and i am getting:
Copy code
{
  "detail": "Not Found"
}
a
Hi @Taofiq Aiyelabegan, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
Based on the documentation, when calling the user permissions endpoint, you should be making a POST request to
<http://localhost:7766/user-permissions>
(assuming your PDP is running on localhost:7766) (1) . Here's the correct format for the API call:
Copy code
curl --location '<http://localhost:7766/user-permissions>' \  
--header 'Content-Type: application/json' \  
--header 'Authorization: Bearer <api key>' \  
--data '{  
 "user": {  
 "key": "eddie"  
 },  
 "resource_types": [  
 "document",  
 "__tenant"  
 ],  
 "context": {  
 "enable_abac_user_permissions": true  
 }  
}'
The "Not Found" error typically indicates either: • The endpoint URL is incorrect • The PDP is not running or not accessible at the specified address • The API path is wrong To help our engineers investigate this issue further, please provide: 1. Which Workspace / Project / Env you are using 2. The exact call you're performing (as SDK code or CURL from Postman) 3. Which PDP version you are running 4. Any relevant logs from your PDP
To learn more, see the sources I considered: [[1] Get user permissions](https://docs.permit.io/how-to/enforce-permissions/user-permissions)
t
see the cURL request @Ask Inkeep
Copy code
curl --location '<https://cloudpdp.api.permit.io/user-permissions>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer permit_key_xxxxxxxxxx' \
--data '{
    "user": {
      "key": "ehowe"
    },
    "resource_types": [
      "document",
      "__tenant"
    ],
    "context": {
      "enable_abac_user_permissions": true
    }
  }'
a
Thanks for tagging me @Taofiq Aiyelabegan. I'll look through relevant sources and get back to you shortly.
I see you're trying to use the Cloud PDP endpoint. The issue is that the URL structure for Cloud PDP is different from what you're using. For the Permit.io API, the correct endpoint structure is
<https://api.permit.io/v2/>
for API calls (1) . If you're using the EU region, it would be
<https://api.eu.permit.io>
. The
/user-permissions
endpoint you're trying to use appears to be a PDP-specific endpoint that would typically be called on your local or container PDP instance, not directly on the Cloud PDP API. To help debug this issue, could you please provide: 1. Which Workspace / Project / Env you are using 2. The exact calls you're performing (you've shared the CURL - thank you!) 3. Which PDP version you are running (Cloud PDP, Container, or local?) 4. Any relevant logs from your PDP if you have access to them This information will help our engineers investigate why you're getting the "Not Found" error.
To learn more, see the sources I considered: [[1] Using the API](https://docs.permit.io/api/api-with-cli)
o
Hey @Taofiq Aiyelabegan The cloudpdp does not support complex queries such as get user permissions. To do that you should run a pdp container and configure your client to it
t
I see, so I spin up the docker instance of my pdp and make the request to the /user-permissions with my local base url? @Omer Zuarets
o
Exactly šŸ™Œ
t
thank you very much🦜
permiticon 1
one last question @Ask Inkeep is there an endpoint for
Get Authorized Users
cant find it yet
a
Thanks for tagging me @Taofiq Aiyelabegan. I'll look through relevant sources and get back to you shortly.
Yes, there is an endpoint for getting authorized users. According to the documentation, you can use the
/authorized_users
endpoint (1) (2) . Here's how to call it using cURL:
Copy code
curl --location '<http://localhost:7766/authorized_users>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <api key>' \
--data '{   
 "action": "read",  
 "resource": {  
 "type": "Document",  
 "tenant":"default",  
 "attributes": {  
 "cost":500,  
 "create_at": 2024  
 },  
 "context": {  
 "enable_abac_authorized_users": true  
 }   
 }  
}'
(1) Or if you're using Python:
Copy code
from permit import AuthorizedUsersResult  
  
authorized_users: AuthorizedUsersResult = permit.authorized_users(  
 "read", "repo",  
)
This function returns a list of users who have access to perform a specific action on a resource, including the user's role assignments that granted the access . Note that this feature is available starting from PDP version 0.4.0 and is currently in EAP stage .
To learn more, see the sources I considered: [[1] Get resource authorized users 🚧](https://docs.permit.io/how-to/enforce-permissions/authorized-users) [[2] Advanced Authorization Queries](https://docs.permit.io/overview/advanced-authorization-queries)
t
this is also to be run with local pdp right? @Omer Zuarets
o
Yes
āœ… 1