list_access_requests¶
- UsersApi.list_access_requests(role_id, request_type=None, resource_type=None, request_status=None, resource_id=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
List access requests for the user
Returns access requests for the calling user. By default, the response includes RequestsSent and RequestsReceived, grouped by resource type. Optional filters include RequestType, ResourceType, and RequestStatus, which accept comma-separated values. When ResourceId is provided, ResourceType is required, and the response contains pending access requests for that resource. The caller must have owner or editor access to the resource. This is a read-only operation and is safe to retry.
- Parameters:
role_id (str) – Amorphic role ID used for authorization. (required)
request_type (str) – Comma-separated groups to return: RequestsSent and/or RequestsReceived. When omitted, both are returned.
resource_type (str) – Comma-separated resource type keys (lowercased). Required when ResourceId is set (else IPV-1008). Narrows the user-wide list when ResourceId is omitted.
request_status (str) – Comma-separated statuses (lowercased): requested, approved, denied, revoked. Ignored for ResourceId mode, which always returns pending requested items only.
resource_id (str) – When set with ResourceType, returns pending AccessRequests for that resource instead of RequestsSent/RequestsReceived.
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: GET /access-requests
Success (HTTP 200)¶
User-wide list (UserRequests) or resource-scoped AccessRequests array when ResourceId is set.
Default RequestsSent / RequestsReceived
{
"RequestsSent": {
"Datasets": [
{
"RequestId": "a2f7d3b1-8e5c-4a6f-9d1e-2b3c4d5e6f7a",
"ResourceId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f",
"ResourceName": "orders",
"ResourceType": "datasets",
"AccessType": "read-only",
"RequestStatus": "requested",
"RequestedBy": "user1",
"RequestersComment": "Need access",
"LastModified": "2024-06-01 12:00:00",
"LastModifiedBy": "user1",
"ExpiryTime": "2024-07-01 12:00:00",
"Domain": "sales"
}
]
},
"RequestsReceived": {
"Jobs": []
}
}
Pending requests for one resource
{
"AccessRequests": [
{
"RequestId": "c3d8e4f2-9a6b-5c7d-0e1f-3a4b5c6d7e8f",
"ResourceId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f",
"ResourceType": "datasets",
"AccessType": "editor",
"RequestStatus": "requested",
"RequestedBy": "user2",
"RequestersComment": "Editor access needed",
"LastModified": "2024-06-02 09:00:00",
"LastModifiedBy": "user2",
"ExpiryTime": "2024-07-02 09:00:00"
}
]
}
Errors¶
Documented error codes: IPV-1008, IPV-1041, IPV-1002, AUTH-1010, GE-1085, EMF-1001.
HTTP 400
Validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Common codes: IPV-1008 (ResourceType missing with ResourceId), IPV-1041 (invalid ResourceType), IPV-1002 (resource not found), AUTH-1010 (not owner/editor on resource-scoped GET).
ResourceId without ResourceType
{
"Message": "IPV-1008 - Invalid request body, missing key(s) - ResourceType"
}
Not owner/editor on resource-scoped list
{
"Message": "AUTH-1010 - User user1 is not authorized to perform this operation"
}
HTTP 500
Backend failure. Body is {“Message”: “<CODE> - <text>”} (typically GE-1085 via EMF-1001).
Unexpected failure
{
"Message": "GE-1085 - <exception text>"
}