Solved

Swagger.json for Nutanix API?


Badge +1
  • Adventurer
  • 3 replies
Hello,
Do the Nutanix / Prism Gateway API's have an endpoint for the swagger.json that represents them? I would like to use the swagger code-gen project to generate a client for Nutanix in a different language.

Thanks,
Colter
icon

Best answer by Jon 29 March 2018, 05:35

Hey @wryfi - thanks for the comments. Your timing literally couldn't be any more excellent on this.

I'd love to start an offline thread with you, please feel free to drop me an email - jon@nutanix.com, if you'd like, as I think we could put our heads together and do some really cool stuff. We could also connect via slack, as we're really trying to maintain an open door policy.

That said - For your benefit, and everyone elses:
Take a look at the v3 API, which all around is a much, much, much better designed API. For example, the swagger spec is super easy to access, and is for sure valid.

The v3 API is tech preview as of 5.5.0.x, but is about to go GA with the very next release, which is literally on the "loading dock" waiting to be launched within the next several days *(knock on wood)*. Among other things, we've also exposed this API out of Prism Central in addition to Prism Element, and greatly extended the amount of endpoints and methods that are exposed in the next version.

If you are planning to generate any of your code dynamically, which is highly suggested and encouraged, you can access the raw swagger.json from the API Explorer under the v3 menu, it gives you the link right at the top of the page. We’re OpenAPI 2.0 compliant with v3, so you can use tools like swagger codegen against it if you’d like.

In addition to all that, we've recently-ish launched developer.nutanix.com, which is our new Developer Portal, specifically here: http://developer.nutanix.com/reference/prism_central/v3/

View original

9 replies

Userlevel 7
Badge +30
What language are you trying to build for? We're working on SDK's internally, and it would be good to know.
Badge +1
Hey John,
I'm just putting together a simple Javascript client that I can run from within node. I've created these clients in the past from swagger.json files and so I was curious if it was available somewhere.

Colter
@cjam I was able to find a Swagger spec in Prism. When you first bring up the API Explorer, it briefly flashes a message at the top of the page that contains a (non-clickable) link to the swagger spec.

On my Prism system, it's at /PrismGateway/services/rest/api/api-docs/v2.0, which claims to be a swagger 1.2 spec.

Unfortunately, however, the swagger spec appears to fail validation. I tried using it with both pyswagger and swagger-codegen, but both of them barf on it.

@Jon a good first step would be to fix the Swagger API spec, and then anyone who wants to write against the API has a nice starting point. In terms of languages, I would like to vote for python, as it is probably the mostly widely used language among linux operations folk like me.
Userlevel 7
Badge +30
Hey @wryfi - thanks for the comments. Your timing literally couldn't be any more excellent on this.

I'd love to start an offline thread with you, please feel free to drop me an email - jon@nutanix.com, if you'd like, as I think we could put our heads together and do some really cool stuff. We could also connect via slack, as we're really trying to maintain an open door policy.

That said - For your benefit, and everyone elses:
Take a look at the v3 API, which all around is a much, much, much better designed API. For example, the swagger spec is super easy to access, and is for sure valid.

The v3 API is tech preview as of 5.5.0.x, but is about to go GA with the very next release, which is literally on the "loading dock" waiting to be launched within the next several days *(knock on wood)*. Among other things, we've also exposed this API out of Prism Central in addition to Prism Element, and greatly extended the amount of endpoints and methods that are exposed in the next version.

If you are planning to generate any of your code dynamically, which is highly suggested and encouraged, you can access the raw swagger.json from the API Explorer under the v3 menu, it gives you the link right at the top of the page. We’re OpenAPI 2.0 compliant with v3, so you can use tools like swagger codegen against it if you’d like.

In addition to all that, we've recently-ish launched developer.nutanix.com, which is our new Developer Portal, specifically here: http://developer.nutanix.com/reference/prism_central/v3/
Userlevel 7
Badge +30
Also, I forgot to add - The way that the v2 and below APIs work is ... funky. Theres a reason we completely redesigned the way we're doing things, we took the time to really build it right from the ground up, such that v3 will (eventually) completely replace all the old APIs, and give us a great foundation to stand on.

The v2 and below APIs grew very organically, and came about before the swagger spec was really solidified very well, so we had some technical debt there. We cleared volumes of that debt with the v3 API, which is a from the ground up rewrite
@Jon sounds great! I'm glad to hear you're working on this. I'll check out developer.nutanix.com and drop you an email.
Userlevel 7
Badge +35
How did things go @cjam ? 🤔

BTW - will you and @wryfi be at .NEXT in New Orleans this year? be sure to come by the community lounge to say 'hi'
@aluciani I'm working with @Jon to get a swagger spec that works with swagger-codegen and/or bravado. This seems to be a work in progress on the Nutanix side.

Unfortunately, I will not be attending .NEXT due to lack of travel budget.
Userlevel 7
Badge +30
hey @wryfi - I'll hit you on email today, making progress

Reply