Validate Policy
  • 07 May 2024
  • 1 Minute to read
  • Dark
    Light
  • PDF

Validate Policy

  • Dark
    Light
  • PDF

Article Summary

Post
/api/2.0/policies/{envId}/validation

Validate Policy.
Note - for the older version, see Validate Policy V1.

Notice

Accessing the Policy Management APIs is through a dedicated domain/URL, according to your PlainID Tenant Location
  • United States (US) - https://api.us1.plainid.io
  • Canada (CA) - https://api.ca1.plainid.io
  • Europe (EU) - https://api.eu1.plainid.io
  • Local PAA - https://api.plainid.local


  • Headers

    *Required
    NameValue
    Accepttext/plain;language=rego

    Security
    HTTP
    Type bearer

    For more details about Administration API Authentication, check out the Authentication APIs documentation
    Provide your bearer token in the Authorization header when making requests to protected resources.
    Example: Authorization: Bearer 123

    Path parameters
    envId
    string (uuid) Required

    The Environment ID can be found under the Details tab in the Environment Settings.

    Query parameters
    filter[authWsId]
    string (uuid) Required

    Authorization Workspace ID

    extendedSchema
    boolean

    Toggle to either enable or disable additional metadata, like the Policy id and description, in the response.

    Default"True"
    Body parameters
    Policy
    "# METADATA\n# custom:\n#   plainid:\n#     policyId: 08ae32e4-fbf3-4cc8-b3b9-3b4061d1c825\n#     name: Manage personal account and Credit cards\n#     description: Customer can view and manage their own accounts an credit cards only with MFA\n#     accessType: Allow\npackage policy\nimport future.keywords\n\n# METADATA\n# custom:\n#   plainid:\n#     kind: DynamicGroup\n#     name: dg1\n#     description: \"test DG\"\ndynamic_group(identity){\n  identity.template == \"idWs1\"\n  identity[\"idAttr1\"] == \"test\"\n  identity[\"idAttr1\"] != \"prod\"\n}\n"
    string

    Policy as Rego code

    Responses
    200

    successful operation

    Headers
    x-request-id
    string
    Invalid
    {
      "data": {
        "validationErrors": [
          {
            "args": {
              "0": "at1",
              "1": "ceef5853-1491-4d1c-ae52-2f2a1729b3a4",
              "2": "Claims"
            },
            "code": "PACV-001",
            "id": "ERHCQC",
            "line": 1,
            "message": "Template: [at1] not found in Environment: [ceef5853-1491-4d1c-ae52-2f2a1729b3a4], Hint: did yo  mean [Claims]?",
            "name": "TemplateNotFound"
          }
        ]
      }
    }
    Valid
    {
      "data": {
        "code": "# METADATA\n# custom:\n#   plainid:\n#     policyId: 08ae32e4-fbf3-4cc8-b3b9-3b4061d1c825\n#     name: Manage personal account and Credit cards\n#     description: Customer can view and manage their own accounts an credit cards only with MFA\n#     accessType: Allow\npackage policy\nimport future.keywords\n\n# METADATA\n# custom:\n#   plainid:\n#     kind: DynamicGroup\n#     name: dg1\n#     description: \"test DG\"\ndynamic_group(identity){\n  identity.template == \"idWs1\"\n  identity[\"idAttr1\"] == \"test\"\n  identity[\"idAttr1\"] != \"prod\"\n}\n",
        "validationErrors": null
      }
    }
    Expand All
    object
    data
    object
    code
    string

    Code

    validationErrors
    Array of object | null
    object
    code
    string
    id
    string
    line
    integer
    message
    string
    name
    string
    401

    Unauthorized

    Headers
    x-request-id
    string
    422

    Validation Failed - Invalid UUID

    Headers
    x-request-id
    string
    Invalid ID Format
    {
      "errors": [
        {
          "args": {
            "0": "ed252aa5-9d0c-4193-838-60bf20b13109",
            "1": "uuid"
          },
          "code": "V-032",
          "id": "EEJQMA",
          "message": "$: test is an invalid uuid",
          "name": "UnprocessableEntityError",
          "status": 422
        }
      ]
    }
    Expand All
    object
    errors
    Array of object (error)
    object
    args
    object
    path
    string
    code
    string
    id
    string
    message
    string
    name
    string
    status
    integer

    Was this article helpful?

    What's Next