VMware Cloud Community
orian
Hot Shot
Hot Shot
Jump to solution

Create Swagger file

Hi,

I found the swagger page of the orchestrator.

I also successfully ran a post workflow execution with json application.

Now, I want to create a swagger file in order to use it from another program (not orchestrator or vra).

Is it Possible?

Thanks!

Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

For vRO server REST API, you don't need to create Swagger spec file by hand. The spec is already generated, and the UI you see is automatically generated out of the spec.

Follow these steps to get a copy of this spec file:

1) SSH login to vRO appliance (if your vRO is standalone) or to vRA appliance (if your vRO is embedded in vRA)

2) Get the file /usr/lib/vco/downloads/vco-repo/com/vmware/o11n/o11n-sdk-rest/7.3.0/o11n-sdk-rest-7.3.0.jar

3) Open it with some utility program that can open ZIP files (WinZip, WinRAR, or whatever you use to work with ZIP files)

4) Inside the JAR file, there is a sub-folder named swagger containing a bunch of YAML files

5) If you need the complete Swagger spec file for the whole vRO server REST API, get the file complete-api-spec-<version>.yaml (for vRO 7.3, it would be complete-api-spec-7.3.0-ferris.yaml)

   There are also separate Swagger spec files for the different vRO server REST API, if you don't need the spec for the whole API

View solution in original post

Reply
0 Kudos
5 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Yes, it is surely possible. A good source of information how to start - https://swagger.io/getting-started/

Reply
0 Kudos
orian
Hot Shot
Hot Shot
Jump to solution

Hi,

Can you be more specific?

I'm new in this area...

Thanks!

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

I can't, because there are too many variables to consider, like which framework your REST API is created with, how your project is build, etc. In the most common cases your REST API is implemented using frameworks like Spring MVC or JAX-RS, and then you simply annotate your controllers and methods with annotations from io.swagger.annotation.* package (eg. @API on controllers and @ApiOperation/@ApiResponses on methods), and then during the build phase you use some plug-in like swagger-maven-plugin to scan for these annotations and generate JSON/YAML file with Swagger spec for your REST API service

Reply
0 Kudos
orian
Hot Shot
Hot Shot
Jump to solution

Hi,

I'm still not sure how to begin.

from the site you sent me, I think this is my case:

"If on the other hand you're an API Consumer who wants to integrate with an API that has a Swagger definition you can use the online version of the Swagger UI to explore the API (given that you have a URL to the APIs Swagger definition) - and then use Swagger Codegen to generate the client library of your choice."

I found my relevent api: https://vra_server.../workflow/workflow_id/execution

I filled the workflow ID and created a basic JSON code for the input of the workflow.

After pressing try it out, the workflow ran successfully.

Now my third party program, needs a swagger file in order to runs this workflow.

How do I create this swagger file with all the information (link, worflowID, JSON code)?

By the way, my VMWare vRealize Automation appliance is not connected to the internet...

Thanks,

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

For vRO server REST API, you don't need to create Swagger spec file by hand. The spec is already generated, and the UI you see is automatically generated out of the spec.

Follow these steps to get a copy of this spec file:

1) SSH login to vRO appliance (if your vRO is standalone) or to vRA appliance (if your vRO is embedded in vRA)

2) Get the file /usr/lib/vco/downloads/vco-repo/com/vmware/o11n/o11n-sdk-rest/7.3.0/o11n-sdk-rest-7.3.0.jar

3) Open it with some utility program that can open ZIP files (WinZip, WinRAR, or whatever you use to work with ZIP files)

4) Inside the JAR file, there is a sub-folder named swagger containing a bunch of YAML files

5) If you need the complete Swagger spec file for the whole vRO server REST API, get the file complete-api-spec-<version>.yaml (for vRO 7.3, it would be complete-api-spec-7.3.0-ferris.yaml)

   There are also separate Swagger spec files for the different vRO server REST API, if you don't need the spec for the whole API

Reply
0 Kudos