Loading

How to Add Consumer Endpoint for an API Instance Using API?

Julkaisupäivä: Mar 2, 2024
Tehtävä

GOAL

Add Consumer Endpoint for an API Instance using API Manager REST API.

This is useful when API Instances are generated using REST APIs for CI/CD. The Consumer Endpoint field option is available only after creating the API Instance. 

Vaiheet

Refer the article "How to Retrieve the Id of the Policies Applied to an API Instance" and follow the steps until Step 4 "Retrieve the API ID"

Step 5: Add the Consumer Endpoint

By using the Authorization Token,  Organization ID, Environment ID and API ID from Step 1 to 4, substitute and execute the below API call
 
curl -X PATCH \
-H "Authorization: Bearer <AUTH_TOKEN>" \
-H 'content-type: application/json' \
"https://anypoint.mulesoft.com/apimanager/api/v1/organizations/<Organization_ID>/environments/<Environment_ID>/apis/<API_ID>" \
-d '{"endpointUri":"<ENDPOINT_INCL_PROTOCOL>"}'
      Example for <ENDPOINT_INCL_PROTOCOL> is http://www.xxx.com.au

Below is the output snippet from the above call.
{
    "audit": {
        "created": {},
        "updated": {
            "date": "2020-10-21T02:38:32.502Z"
        }
    },
    "endpoint": {
        "apiGatewayVersion": "4.3.0",
        "apiId": 16421437,
        "audit": {
            "created": {
                "date": "2020-10-14T22:59:26.313Z"
            },
            "updated": {
                "date": "2020-10-14T23:08:18.965Z"
            }
        },
        "deploymentType": "CH",
        "id": 1120997,
        "isCloudHub": null,
        "lastActiveDate": null,
        "masterOrganizationId": "ddd-b32f-4c34-b757-dddd",
        "muleVersion4OrAbove": true,
        "organizationId": "dd-b32f-4c34-b757-ddd",
        "policiesVersion": null,
        "proxyRegistrationUri": null,
        "proxyUri": null,
        "referencesUserDomain": null,
        "responseTimeout": null,
        "type": "raml",
        "uri": "http://apitestproject.cloudhub.io",
        "wsdlConfig": null
    },
    "endpointUri": "http://www.xxx.com.au",
    "environmentId": "yyy-2df0-42c0-acb3-yyy",
    "id": 16421437,
    "masterOrganizationId": "ddd-b32f-4c34-b757-dddd",
    "organizationId": "ddd-b32f-4c34-b757-dddd"
}

 
Knowledge-artikkelin numero

001115948

 
Ladataan
Salesforce Help | Article