VMware Cloud Community
VishalRaja
Contributor
Contributor

vRO Plugin Installation via REST

Is it possible to install a new plugin using rest? If so what is the syntax? I have been trying to find it but could not get any proper document or guide

Tags (1)
0 Kudos
12 Replies
iiliev
VMware Employee
VMware Employee

Yes, it is possible to install a plug-in by making POST request to https://{vroaddress}:8281/vco/api/plugins/ and providing the plug-in binary file in the request body as multi-part content. Description of the parameters and return codes can be found in vRO REST API Swagger documentation at https://{vroaddress}:8281/vco/api/docs (click on plugin-controller node to expand it).

The tricky part is how to represent plug-in's binary DAR file as multi-part content. It depends on the REST client framework you are using; in the vRO Swagger documentation a sample code is provided for Spring's RestTemplate client.

VishalRaja
Contributor
Contributor

Thank you. The below command did the trick. I did not represent it in .dar format. I used .vmoapp directly and it works fine.

curl -k -X POST --user username:password "https://server/vco/api/plugins/installPluginDynamically" -F "file=@filename"

0 Kudos
uber123
Contributor
Contributor

Hey Vishal,

Please can you elloborate your answer, basically even im trying to add the plugin into vRO.

With this command line:: curl -k -X POST --user username:password "https://server/vco/api/plugins/installPluginDynamically" -F "file=@filename"

1. Server : <IP or Hostname> Port needed? Please give one example

2. File: Should be in the vRO or any other appliance that runs this command?

What i have tried, curl -k -X POST --user root:<Password> "https://<IP>:<PORT>/vco/api/plugins/installPluginDynamically" -F "file=/root/<PluginName>.vmoapp"

Result: 401 Unauthorized.

Same works when i list all plugins with "curl -k -X GET --user root:<Password> "https://<IP>:<PORT>/vco-controlcenter/api/plugins/all" "

Thanks in advance!

Cheers

Pawan

0 Kudos
iiliev
VMware Employee
VMware Employee

Hi Pawan,

The command curl -k -X GET --user root:<Password> "https://<IP>:<PORT>/vco-controlcenter/api/plugins/all" works because there you call vRO Control Center REST API, which requires authentication with root credentials.

The command curl -k -X POST --user root:<Password> "https://<IP>:<PORT>/vco/api/plugins/installPluginDynamically" -F "file=/root/<PluginName>.vmoapp" fails with 401 Unauthorized because there you call vRO Server REST API, which requires authentication not with root credentials but with credentials of users valid for the configured vRO Server authentication provider. Try with the user you use when you login into vRO UI Client.

0 Kudos
uber123
Contributor
Contributor

Thanks for the reply.

Yes with client credentials I am getting 400 Bad request.

I have a question, where to run this command? Inside the vRO server?

And where to keep .vmoapp plugin file?

0 Kudos
iiliev
VMware Employee
VMware Employee

It is not necessary to run the command inside vRO server, or keep the vmoapp file on vRO machine. You can run it on any machine where you have curl and vmoapp file available.

/

You are getting 400 Bad Request because the command string / request body is not correct. Instead of

-F "file=/root/<PluginName>.vmoapp"

it should end up with something like

-F "file=@/path/to/<PluginName>.vmoapp"

note the @ character which is missing in your variant, and which is essential to provide the correct request body (content of the vmoapp file instead of the name of the vmoapp file

0 Kudos
uber123
Contributor
Contributor

thanks  again Smiley Happy

After your suggestion, I see command line returns with no message and close the command execution without any response.

Is this expected?

But I don't see my plugin in vRO control center either.

0 Kudos
iiliev
VMware Employee
VMware Employee

Well, if the command doesn't report an error, it should be a successful execution. You can add option -v to curl command to make it more verbose.

Not sure when Control Center obtains a list of plug-ins (on startup or every time you open Manage Plug-ins page). Could you try to refresh the page, or logout and login again in it to see if the plug-in will show?

Another place to check if the plug-in is installed is in vRO Legacy Client > Help > Installed plugins... menu. There is also a REST API to fetch the list of plug-ins.

In the worst case, you can try to restart the server, although the name of the API implies that plug-in installation should happen dynamically and not require a server restart.

0 Kudos
uber123
Contributor
Contributor

I'm one step closer but yet to see actual result.

Now with your suggestion I'm getting 204 No content as a response.

You have any idea why it's coming?

Thanks in advance .

0 Kudos
iiliev
VMware Employee
VMware Employee

Http status codes 2xx indicate success.

In this particular case, 204 No content means the REST API call has completed successfully, but there is no response body to return to the caller. And indeed, looking at the code of installPluginDynamically, it is a Java method that takes as input the plug-in file to upload, but does not return any response object (the Java method has 'void' return type).

0 Kudos
uber123
Contributor
Contributor

Thanks again.

But I'm getting No content as a response but I don't see plugin getting uploaded in vRO.

I tried,

1. Restarting vRO

2. Tried with postman - same response "No Content"

Nothing helped.

Let me know even you see No content as a response?

0 Kudos
iiliev
VMware Employee
VMware Employee

"No Content" is the expected response from a successful call to this API.

0 Kudos