How to Start/Stop/Delete Applications in On-Prem servers using Rest API with Connected app credentials
1. Refer to KB "Creating connected app and getting the bearer token example" to create a connected app with minimum scopes required for Runtime Manager REST API.
The minimum scopes required for the connected app to stop/start the applications are as follows.
RUNTIME MANAGER
Create Applications
Manage Application Data
Read Applications
Read Servers
2. Get the bearer token from the connected app's client ID and client secret.
curl --location --request POST https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'client_id=<CLIENT ID from step 1>' \ --data-urlencode 'client_secret=<CLIENT SECRET from step 1>' \ --data-urlencode 'grant_type=client_credentials'
3. To find the applicationID, you can either grab the applicationID from the Runtime Manager UI or use the curl command below.
curl --location --request GET 'https://anypoint.mulesoft.com/hybrid/api/v1/applications' \ --header 'X-ANYPNT-ORG-ID: <organizationID>' \ --header 'X-ANYPNT-ENV-ID: <enviromentID>' \ --header 'Authorization: Bearer <token>'
4. Invoke the following curl commands to start or stop the applications in on-prem servers
curl --location --request PATCH 'https://anypoint.mulesoft.com/hybrid/api/v1/applications/<applicationID>' \
--header 'X-ANYPNT-ORG-ID: <organizationID>' \
--header 'X-ANYPNT-ENV-ID: <enviromentID' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data-raw '{"desiredStatus":"STOPPED"}'
curl --location --request PATCH 'https://anypoint.mulesoft.com/hybrid/api/v1/applications/<applicationID>' \
--header 'X-ANYPNT-ORG-ID: <organizationID>' \
--header 'X-ANYPNT-ENV-ID: <enviromentID' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data-raw '{"desiredStatus":"STARTED"}'
curl --location --request GET 'https://anypoint.mulesoft.com/hybrid/api/v1/applications/<applicationID>' \ --header 'X-ANYPNT-ORG-ID: <organizationID>' \ --header 'X-ANYPNT-ENV-ID: <enviromentID>' \ --header 'Authorization: Bearer <token>'
curl --location --request DELETE 'https://anypoint.mulesoft.com/hybrid/api/v1/applications/<applicationID>' \ --header 'X-ANYPNT-ORG-ID: <organizationID>' \ --header 'X-ANYPNT-ENV-ID: <enviromentID>' \ --header 'Authorization: Bearer <token>'
Creating connected app and getting the bearer token example
Minimum permission for hybrid deployment using Runtime Manager UI or Mule Maven Plugin
Runtime Manager REST Services
001119911

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.