+ All Categories
Home > Technology > MMC Rest API - Servers

MMC Rest API - Servers

Date post: 15-Apr-2017
Category:
Upload: kiran-boddepalli
View: 359 times
Download: 0 times
Share this document with a friend
24
MMC Rest API - Servers BY KIRAN KUMAR
Transcript

MMC Rest API - ServersBY KIRAN KUMAR

Introduction

MMC Rest API provides an ability to access the server, files, operations on flows and operations on endpoints as shown below.

1. Register a Server2. Get All Servers3. Get a Server4. Unregister a Server5. Update a Server6. Get All Applications

7. Restart a Server8. Stop a Server9. Get All Files10. Get a File11. Create a File12. Update a File13. Delete a File

14. Get All Flows15. Start a Flow16. Stop a Flow17. Get All Endpoints18. Start an Endpoint19. Stop an Endpoint

Register a Server

To register a server with MMC, need to provide server name, server agent URL and group id of the server as shown in the below URL.

curl --basic -u username:password -d '{ "name" : "Server Name", "agentUrl" : "http://localhost:7777/mmc-support", "groupIds":["server group id"] }' --header 'Content-Type: application/json' http://localhost:8585/mmc/api/servers

HTTP Method: POST

Get All Servers

To get all servers, need to provide the below URL. curl --basic -u username:password

http://localhost:8585/mmc/api/servers HTTP Method: GET

Get a Server

To get a specific server, need to provide the server id as shown in the below URL.

curl --basic -u username:password 'http://localhost:8585/mmc/api/servers/{serverId}'

HTTP Method: GET

Unregister a Server

To Unregister a specific server, need to provide the server id as shown in the below URL.

curl --basic -u username:password -X DELETE 'http://localhost:8585/mmc/api/servers/{serverId}'

HTTP Method: DELETE

Update a Server

To update a specific server details, need to provide the details for the server id as shown in the below URL.

curl --basic -u username:password -X PUT -d '{"name" : "New Server Name", "groups":[{"href":"group id"}]}' --header 'Content-Type: application/json' 'http://localhost:8585/mmc/api/servers/{serverId}'

HTTP Method: PUT

Get All Applications

To get all applications on a specific server, need to provide the server id as shown in the below URL.

curl --basic -u username:password 'http://localhost:8585/mmc/api/servers/{serverId}/applications'

HTTP Method: GET

Restart a Server

To restart a server, need to provide the server id as shown in the below URL.

curl --basic -u username:password 'http://localhost:8585/mmc/api/servers/{serverId}/restart'

HTTP Method: POST

Stop a Server

To stop a server, need to provide the server id as shown in the below URL.

curl --basic -u username:password 'http://localhost:8585/mmc/api/servers/{serverId}/stop'

HTTP Method: POST

Get All Files

To get all files on a specific server, need to provide the server id as shown in the below URL.

curl --basic -u username:password 'http://localhost:8585/mmc/api/servers/{serverId}/files'

HTTP Method: GET

Get a File

To get a specific file on a specific server, need to provide the relative path of a file from root folder of server and the server id as shown in the below URL.

curl --basic -u username:password 'http://localhost:8585/mmc/api/servers/{serverId}/files/{relativePathToFile}'

HTTP Method: GET

Create a File

To create a new file on a specific server, need to provide the server id and the relative file path of a server as shown in the below URL.

curl --basic -u username:password -v --header 'Content-Type:application/octet-stream' --data-binary '@source.xml' 'http://localhost:8585/mmc/api/servers/{serverId}/files/logs/destination.txt'

HTTP Method: POST source.xml is a source file name. ’@’ is used to copy the contents of the

source file to destination. If it is not specified then source.xml will be the contents for the destination file.

destination.txt is the destination file name.

Update a File

To replace or update a content/file in the target folder on the specified server, need to provide the server id and relative path of the file on the server as shown in the below URL.

curl --basic -u username:password -X PUT --header 'Content-Type:application/octet-stream' --data-binary '@source.xml' 'http://localhost:8585/mmc/api/servers/{serverId}/files/{relativePathToFile}'

HTTP Method: PUT

Delete a File

To delete a file on the specified server, need to provide the server id and relative file path of the specified server as shown in the below URL.

curl --basic -u username:password -X DELETE 'http://localhost:8585/mmc/api/servers/{serverId}/files/logs/destination.txt'

HTTP Method: DELETE

Get All Flows

To get all flows on a server, need to provide server id as shown in the below URL.

curl --basic -u username:password 'http://localhost:8585/mmc/api/servers/{serverId}/flows'

HTTP Method: GET

Start a Flow

To start a flow on a specific server, need to provide the server id, application name and flow name as shown in the below URL.

curl --basic -u username:password -X POST 'http://localhost:8585/mmc/api/servers/{serverId}/flows/{flowName}/{applicationName}/start'

HTTP Method: POST

Stop a Flow

To stop a flow on a specific server, need to provide the server id, application name and flow name as shown in the below URL.

curl --basic -u username:password -X POST 'http://localhost:8585/mmc/api/servers/{serverId}/flows/{flowName}/{applicationName}/stop'

HTTP Method: POST

Get All Endpoints

To get all endpoints of a specific flow of an application on a specific server, need to provide server id, application name and flow name as shown in the below URL.

curl --basic -u username:password 'http://localhost:8585/mmc/api/servers/{serverId}/flows/{flowName}/{applicationName}/endpoints'

HTTP Method: GET

Start an Endpoint

To start an endpoint of a specific flow of an application on a specific server, need to provide server id, application name, flow name and endpoint id as shown in the below URL.

curl --basic -u username:password -X POST 'http://localhost:8585/mmc/api/servers/{serverId}/flows/{flowName}/{applicationName}/endpoints/{endpointId}/start'

HTTP Method: POST

Stop an Endpoint

To stop an endpoint of a specific flow of an application on a specific server, need to provide server id, application name, flow name and endpoint id as shown in the below URL.

curl --basic -u username:password -X POST 'http://localhost:8585/mmc/api/servers/{serverId}/flows/{flowName}/{applicationName}/endpoints/{endpointId}/stop'

HTTP Method: POST

Thank You


Recommended