Skip to content

Get the data policy list ​

This document is automatically generated based on https://github.com/authing/authing-docs-factory based on https://api-explorer.genauth.ai V3 API, and is consistent with API parameters and return results. If the description of this document is incorrect, please refer to V3 API.

Query the data policy list by page, or search the data policy name or data policy code by keyword for fuzzy search.

Method name ​

ManagementClient.listDataPolices

Request parameters ​

NameTypeRequiredDefault valueDescriptionExample value
pagenumberNo1Current page number, starting from 11
limitnumberNo10Number per page, maximum cannot exceed 50, default is 1010
querystringNo-Data policy name keyword searchexamplePolicyName

Sample code ​

ts
import { ManagementClient, Models } from "authing-node-sdk";

// Initialize ManagementClient
const managementClient = new ManagementClient({
  // Need to be replaced with your GenAuth Access Key ID
  accessKeyId: "GEN_AUTH_ACCESS_KEY_ID",
  // Need to be replaced with your GenAuth Access Key Secret
  accessKeySecret: "GEN_AUTH_ACCESS_KEY_SECRET",
  // If it is a private deployment customer, you need to set the GenAuth service domain name
  // host: 'https://api.your-authing-service.com'
});

(async () => {
  const result = await managementClient.listDataPolices({
    page: 1,
    limit: 10,
    query: "examplePolicyName",
  });

  console.log(JSON.stringify(result, null, 2));
})();

Request response ​

Type: ListDataPoliciesPaginatedRespDto

NameTypeDescription
statusCodenumberBusiness status code, which can be used to determine whether the operation is successful. 200 means success.
messagestringDescription
apiCodenumberSegmented error code, which can be used to get the specific error type (successful request does not return). For a detailed list of error codes, see: API Code List
requestIdstringRequest ID. Returned when the request fails.
data<a DataPoliciesPaginatedRespDtoResponse data

Sample result:

json
{
  "statusCode": 200,
  "message": "Operation successful",
  "requestId": "934108e5-9fbf-4d24-8da1-c330328abd6c",
  "data": {
    "totalCount": 20,
    "list": {
      "policyName": "Sample data policy name",
      "description": "Sample data policy description",
      "resourceList": {
        "resourceId": "6301cexxxxxxxxx27478",
        "resourceName": "Resource 1"
      },
      "policyId": "60b49xxxxxxxxxxxxxxx6e68",
      "targetList": {
        "id": "6301cexxxxxxxxxxxxxxxxx78",
        "type": "USER",
        "name": "test"
      },
      "updatedAt": "2022-07-03T03:20:30.000Z"
    }
  }
}

Data structure ​

DataPoliciesPaginatedRespDto ​

NameTypeIs it requiredDescriptionSample value
totalCountnumberyesTotal number of records20
listarrayyesResponse data Nested type: <a ListDataPoliciesRespDto.

ListDataPoliciesRespDto ​

NameTypeIs it requiredDescriptionSample value
policyNamestringyesData policy name, unique to the user poolSample data policy name
descriptionstringnoData policy descriptionSample data policy description
resourceListarrayyesData permission list, all data resource IDs and names under each policy Nested type: <a DataResourceSimpleRespDto.
policyIdstringyesData policy ID60b49xxxxxxxxxxxxxxx6e68
targetListarrayyesSubject object list, including all subject objects under the data policy, including USER, GROUP, ROLE, ORG Nested type: <a SubjectRespDto.
updatedAtstringyesData policy update time2022-07-03T03:20:30.000Z

DataResourceSimpleRespDto ​

NameTypeIs it required?DescriptionSample value
resourceIdstringyesData resource ID to which the data permission belongs6301cexxxxxxxxx27478
resourceNamestringyesData resource name to which the data permission belongsResource1

SubjectRespDto ​

NameTypeIs it required?DescriptionSample value
idstringYesSubject ID, including user ID, user group ID, role ID, organization ID6301cexxxxxxxxxxxxxxxxx78
typestringYesSubject type, including USER, GROUP, ROLE, ORGUSER
namestringYesSubject name, including user name, user group name, role name, organization nametest