Loading

How to update API policy details using Platform APIs

Data pubblicazione: Mar 2, 2024
Fasi
GOAL

This article provides API endpoints to retrieve and update policies applied on an API instance

PROCEDURE

Please refer the knowledge article for How to generate your Authorization Bearer token for Anypoint Platform

1. Retrieve all the policy details for the respective API instance-

API Endpoint - GET https://anypoint.mulesoft.com/apimanager/api/v1/organizations/{ORG_ID}/environments/{ENV_ID}/apis/{api_instance_id}/policies

Sample CURL - 
curl --location --request GET 'https://anypoint.mulesoft.com/apimanager/api/v1/organizations/0xxxx6/environments/9xxxx0/apis/1xxxx3/policies' \
--header 'Authorization: Bearer fxxxx3'


2. Retrieve all details related to a specific policy within an API instance-

API Endpoint - GET https://anypoint.mulesoft.com/apimanager/api/v1/organizations/{ORG_ID}/environments/{ENV_ID}/apis/{api_instance_id}/policies/{policy_id}

Sample CURL- 
curl --location --request GET 'https://anypoint.mulesoft.com/apimanager/api/v1/organizations/0xxxx6/environments/9xxxx0/apis/1xxxx3/policies/3xxxx1' \
--header 'Authorization: Bearer fxxxx3'

3. To update the policy details-

Copy the configurationData from the response block of the above outcome and add it as a Body to the PATCH Request with updated values.

API Endpoint - PATCH https://anypoint.mulesoft.com/apimanager/api/v1/organizations/{ORG_ID}/environments/{ENV_ID}/apis/{api_instance_id}/policies/policy_id

Sample CURL for one of the policies - 
curl --location --request PATCH 'https://anypoint.mulesoft.com/apimanager/api/v1/organizations/0xxxx6/environments/9xxxx0/apis/1xxxx3/policies/3xxxx1' \
--header 'Authorization: Bearer 6xxxx1' \
--header 'Content-Type: application/json' \
--data-raw '{"configurationData": {
        "maximumRequests": 1,
        "timePeriodInMilliseconds": 3000,
        "delayTimeInMillis": 3000,
        "delayAttempts": 1,
        "queuingLimit": 5,
        "exposeHeaders": false
    }
}'

ADDITIONAL INFORMATION
MuleSoft's Developer Portal
 
Numero articolo Knowledge

001115464

 
Caricamento
Salesforce Help | Article