Authorizations
The Tyk Dashboard API Access Credentials
Body
application/json
Create rule to prevent creation of keyless APIs.
curl --request PUT \
--url https://{tenant}/api/org/opa \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"open_policy": {
"rules": "package dashboard_users\ndefault request_intent = \"read\"\nrequest_intent = \"write\" { input.request.method == \"POST\" }\nrequest_intent = \"write\" { input.request.method == \"PUT\" }\nrequest_intent = \"delete\" { input.request.method == \"DELETE\" }\ndeny[\"You cannot create a keyless API.\"] {\n request_intent == \"write\"\n contains(input.request.path, \"api/apis\")\n input.request.body.api_definition.use_keyless == true\n}"
}
}'
{
"Message": "OPA rules has been updated on org level.",
"Meta": null,
"Status": "OK"
}
Modify your OPA rules.
curl --request PUT \
--url https://{tenant}/api/org/opa \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"open_policy": {
"rules": "package dashboard_users\ndefault request_intent = \"read\"\nrequest_intent = \"write\" { input.request.method == \"POST\" }\nrequest_intent = \"write\" { input.request.method == \"PUT\" }\nrequest_intent = \"delete\" { input.request.method == \"DELETE\" }\ndeny[\"You cannot create a keyless API.\"] {\n request_intent == \"write\"\n contains(input.request.path, \"api/apis\")\n input.request.body.api_definition.use_keyless == true\n}"
}
}'
{
"Message": "OPA rules has been updated on org level.",
"Meta": null,
"Status": "OK"
}
The Tyk Dashboard API Access Credentials
Create rule to prevent creation of keyless APIs.
Show child attributes
Was this page helpful?