Jump to content
Ultimaker Community of 3D Printing Experts
jeromechrist

Web API : swagger docs is wrong

Recommended Posts

Hello,

I'm using a Ultimaker3 with firmware : 3.7.7.20170627 (latest from stable).

I have the following issue when calling GET /printer via a client generated from swagger tools : the Network object returns differs from the spec (returns an object : is an enum in spec), which throws a serialization exception.

 

  • Is there an updated - correct - swagger doc somewhere ?
  • A nuget package for a c# client ?
  • If not, a github repo where we can contribute ?

 

Thanks !

Edited by Guest

Share this post


Link to post
Share on other sites
2 hours ago, Deckard said:

Can someone point me to a spec that I can use as an input to the Swagger tools?

 

I'm not quite sure if this was your question,

but once your Ultimaker3 is connected to your network you can simply enter the printers ip-address in a web-browser. This opens the start page of the printers web server and there's a link to the API documentation.

Share this post


Link to post
Share on other sites

Thanks, tinkergnome.

 

I'm not after the human readable doc, I'm after the JSON file that defines the API so I can generate a client with my chosen language bindings.

 

Is that served up somewhere in the printer perhaps? If so, I haven't been able to find it.

Edited by Deckard

Share this post


Link to post
Share on other sites
6 hours ago, Deckard said:

Thanks, tinkergnome.

 

I'm not after the human readable doc, I'm after the JSON file that defines the API so I can generate a client with my chosen language bindings.

 

Is that served up somewhere in the printer perhaps? If so, I haven't been able to find it.

 

swagger doc should be available at http://ipforyourprinter/docs/api/

Share this post


Link to post
Share on other sites

See the reply above for the nice formatted Swagger page with API documentation.

Or download the raw json file from: http://ipforyourprinter/docs/api/api_documentation.json

 

We attempt to keep this document up to date, but it isn't tested a lot. When you find problems, then please report them so we can fix it.

Share this post


Link to post
Share on other sites

Hi Carlo,

 

Thanks very much for your response. I'm afraid that I have caused some confusion here by not being very clear on what I'm after. I apologize.

 

When I say "spec" I am referring to the Swagger specification file that defines the API, and is subsequently used as to generate the documentation, the server stubs, and client bindings. This is a YAML file or can also be interchanged as JSON. It is this file, literally the specification of the API, in which I'm interested. It was formerly called the Swagger Specification but is now called the OpenAPI Specification.

 

This file can be used as an input to the Swagger Codegen client generation tool (or other tools). See here:

https://swagger.io/tools/swagger-codegen/

 

With the specification in hand, client source code can be automatically generated targeting a large number of languages and the client needn't be coded by hand.

 

I've searched the web and the Ultimaker github repos, and I have not been able to find it.

 

Is it possible to get this file posted somewhere?

 

Thanks,

Deckard

 

Share this post


Link to post
Share on other sites

Did you look at the referred links? This isn't my expert field, but to my best understanding this file on the printer is what you are looking for.

Too bad we are not (yet) allowed to open our github repositories, so that's why you won't find the info there. But, the printer itself is a good source of info (enable developer mode and using SSH the whole printer is open to you).

Share this post


Link to post
Share on other sites
On 9/16/2018 at 6:47 PM, Deckard said:

Hi Carlo,

 

Thanks very much for your response. I'm afraid that I have caused some confusion here by not being very clear on what I'm after. I apologize.

 

When I say "spec" I am referring to the Swagger specification file that defines the API, and is subsequently used as to generate the documentation, the server stubs, and client bindings. This is a YAML file or can also be interchanged as JSON. It is this file, literally the specification of the API, in which I'm interested. It was formerly called the Swagger Specification but is now called the OpenAPI Specification.

 

This file can be used as an input to the Swagger Codegen client generation tool (or other tools). See here:

https://swagger.io/tools/swagger-codegen/

 

With the specification in hand, client source code can be automatically generated targeting a large number of languages and the client needn't be coded by hand.

 

I've searched the web and the Ultimaker github repos, and I have not been able to find it.

 

Is it possible to get this file posted somewhere?

 

Thanks,

Deckard

 

 

go tp http://ipforyourprinter/docs/api/ it will display the swagger-ui or as @CarloK posted, http://ipforyourprinter/docs/api/api_documentation.json will output the swagger doc as json that you use to generate a client with

 

Edited by jeromechrist

Share this post


Link to post
Share on other sites

I apologize for the distractions here. I really feel like a dummy.

 

I started with the Swagger Codegen tool and it refused to ingest that JSON file complaining that it was malformed for an API spec. However, NSwag Studio will ingest it just fine. Scratching my head.

 

Thanks for your patience.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!