Ana içeriğe geç

Policy Group

General Information​

Policy Type​

policy-group

Description​

Policy Group is a container policy that groups multiple policies together. It allows organizing and managing related policies as a single unit. This policy type is currently in development and may have limited functionality.

Note: This policy type is currently under development. The implementation may be incomplete or subject to change.

Endpoints​

List Policies​

GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/

Add Policy​

POST /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

Update Policy​

PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

Delete Policy​

DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

List Policies​

Endpoint​

GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name

Response​

Success Response (200 OK)​

{
"status": "SUCCESS",
"resultList": [
{
"apiProxy": {
"name": "MyAPI",
"requestPolicyList": [
{
"type": "policy-group",
"name": "policy-group-1",
"description": "Group of related policies",
"active": true
}
],
"responsePolicyList": [],
"errorPolicyList": []
}
}
],
"resultCount": 1
}

cURL Example​

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/policies/" \
-H "Authorization: Bearer YOUR_TOKEN"

Add Policy​

Endpoint​

POST /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}
Content-Typeapplication/json

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name
policyNamestringYesPolicy name (must match name in body)

Request Body​

Full JSON Body Example - Basic Policy Group​
{
"operationMetadata": {
"targetScope": "API_PROXY",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "policy-group",
"name": "policy-group-1",
"description": "Group of related policies",
"active": true,
"policyCondition": {
"criteria": "ALWAYS",
"rules": []
}
}
}

Request Body Fields​

operationMetadata​
FieldTypeRequiredDefaultDescription
targetScopestringYes-Policy scope: API_PROXY or ENDPOINT
targetEndpointstringNo*-Endpoint path (required if targetScope=ENDPOINT)
targetEndpointHTTPMethodstringNo*-HTTP method (required if targetScope=ENDPOINT)
targetPipelinestringYes-Pipeline: REQUEST, RESPONSE, or ERROR
deploybooleanNotrueWhether to deploy after adding policy
deployTargetEnvironmentNameListarrayNo[]List of environment names to deploy to
orderintegerNonullPolicy execution order (starts from 1)
policy​
FieldTypeRequiredDefaultDescription
typestringYes-Policy type: policy-group
namestringYes-Policy name (must match path parameter)
descriptionstringNo-Policy description
activebooleanNotrueWhether policy is active
policyConditionobjectNonullPolicy condition. See PolicyConditionDTO

PolicyOperationMetadataDTO (operationMetadata)​

FieldTypeRequiredDescription
targetScopestringYesTarget scope. See EnumPolicyTargetScope
targetEndpointstringNoTarget endpoint path (if targetScope is ENDPOINT)
targetEndpointHTTPMethodstringNoTarget endpoint HTTP method (if targetScope is ENDPOINT)
targetPipelinestringYesTarget pipeline. See EnumPolicyTargetPipeline
deploybooleanNotrue
deployTargetEnvironmentNameListarrayNo[]
orderintegerNo-

EnumPolicyTargetScope (operationMetadata.targetScope)​

  • API_PROXY - Apply to entire API Proxy
  • ENDPOINT - Apply to specific endpoint
  • GLOBAL - Apply globally

EnumPolicyTargetPipeline (operationMetadata.targetPipeline)​

  • REQUEST - Request pipeline
  • RESPONSE - Response pipeline
  • ERROR - Error pipeline

PolicyConditionDTO (policyCondition)​

FieldTypeRequiredDescription
criteriastringYesCondition criteria. See EnumConditionCriteria
rulesarrayYesList of condition rules. See ConditionRuleDTO

EnumConditionCriteria (policyCondition.criteria)​

  • ALWAYS - Always execute policy
  • IF_ALL_MATCH - Execute if all rules match
  • IF_ANY_MATCH - Execute if any rule matches
  • IF_NONE_MATCH - Execute if no rules match

ConditionRuleDTO (policyCondition.rules item)​

See Add Policy for detailed documentation. The structure matches the ConditionRuleDTO defined in the Add Policy documentation.

Notes​

  • This policy type is currently under development.
  • Policy Group specific fields may be added in future versions.
  • Currently, Policy Group acts as a container for organizing policies.

Response​

Success Response (200 OK)​

{
"status": "SUCCESS",
"resultList": null,
"resultCount": null,
"deploymentResult": {
"envName": "production",
"podName": "",
"podIp": "",
"success": true,
"detail": "",
"responseTime": 123,
"detailList": []
}
}

cURL Example​

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/policies/policy-group-1/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationMetadata": {
"targetScope": "API_PROXY",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "policy-group",
"name": "policy-group-1",
"description": "Group of related policies",
"active": true,
"policyCondition": {
"criteria": "ALWAYS",
"rules": []
}
}
}'

Update Policy​

Endpoint​

PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}
Content-Typeapplication/json

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name
policyNamestringYesPolicy name (must match name in body)

Request Body​

Note: Request body structure is the same as Add Policy. All fields should be provided for update.

Response​

Success Response (200 OK)​

{
"status": "SUCCESS",
"resultList": null,
"resultCount": null,
"deploymentResult": {
"envName": "production",
"podName": "",
"podIp": "",
"success": true,
"detail": "",
"responseTime": 123,
"detailList": []
}
}

Delete Policy​

Endpoint​

DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name
policyNamestringYesPolicy name

Response​

Success Response (200 OK)​

{
"status": "SUCCESS",
"resultList": null,
"resultCount": null,
"deploymentResult": {
"envName": "production",
"podName": "",
"podIp": "",
"success": true,
"detail": "",
"responseTime": 123,
"detailList": []
}
}

Notes and Warnings​

  • Development Status:

    • This policy type is currently under development
    • Implementation may be incomplete
    • Functionality may change in future versions
  • Purpose:

    • Policy Group is intended to group multiple policies together
    • Allows organizing and managing related policies as a single unit
    • May provide additional functionality in future versions
  • Usage:

    • Currently acts as a container for organizing policies
    • Specific group functionality may be added later
    • Check latest documentation for updates
  • Deployment: Policy changes require deployment to take effect. Set deploy: true in operationMetadata or deploy manually.