Import Building Blocks.
Users can only import up to 50 building blocks per request.
Notice
Accessing the Policy Management APIs is through a dedicated domain/URL, according to your PlainID Tenant Locationhttps://api.us1.plainid.io
https://api.ca1.plainid.io
https://api.eu1.plainid.io
Using HTML Encoded Special Characters
Use HTML encoded patterns when working with values that contain special characters like spaces, dashes, etc. Refer to this HTML URL Encoding Reference for a full list.
Important note about headers
Refer to the headers below to modify your cURL sample. Check if the following headers are in the sample, if not, ensure you add it to your cURL sample before pasting into your API tool.
Headers
*RequiredHeader | Value | cURL Line |
---|---|---|
Accept | text/plain;language=rego | -H "Accept :text/plain;language=rego" |
Content-Type | text/plain;language=rego | -H "Content-Type:text/plain;language=rego" |
cURL Sample Guidelines
In order for the relevant parameters to appear in the cURL sample, you can input the values in the interactive API console on the right. They will then appear in the cURL sample on the bottom of the page in the correct format.
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
The Environment ID can be found under the Details tab in the Environment Settings.
This can be found in your Authorization Workspace Settings under Workspace ID. *Required if identityWsId
is not provided.
Identity Workspace ID. *Required if authWsId
is not provided.
Toggle to enable or disable additional metadata in the response, like the Building Block id
and description
.
"package building_blocks\nimport rego.v1\n\n# METADATA\n# custom:\n# plainid:\n# kind: DynamicGroup\n# name: dg1\n# description: dg1\ndynamic_group(identity) if {\n identity.template == \"idWs1\"\n identity[\"idAttr1\"] == \"test\"\n identity[\"idAttr1\"] != \"prod\"\n}\n"
Building Blocks as Rego code
successful operation
"package building_blocks\nimport rego.v1\n\n# METADATA\n# custom:\n# plainid:\n# kind: DynamicGroup\n# name: dg1\n# id: f28c17c2-caeb-4cf2-a549-02bf03fe4e17\n# description: dg1\ndynamic_group(identity) if {\n identity.template == \"idWs1\"\n identity[\"idAttr1\"] == \"test\"\n identity[\"idAttr1\"] != \"prod\"\n}\n"
Building Blocks as Rego code
bad request
{
"errors": [
{
"code": "PAC-005",
"args": {
"0": "67c1ffe0-a540-4662-b894-0813abcc04ec"
},
"id": "ERHCQC",
"status": 400,
"name": "IdentityWsNotFound",
"message": "IdentityWs: [67c1ffe0-a540-4662-b894-0813abcc04ec] not found"
}
]
}
Unauthorized
Validation Failed - Invalid UUID
{
"errors": [
{
"code": "V-032",
"args": {
"0": "ed252aa5-9d0c-4193-838-60bf20b13109",
"1": "uuid"
},
"id": "EEJQMA",
"status": 422,
"name": "UnprocessableEntityError",
"message": "$: test is an invalid uuid"
}
]
}