Generate and Publish Ruby Based Rest APIs Documentation

Generate and publish Ruby based REST APIs documentation

Sounds like you don't have an API yet? If that's the case, this is the approach that I recommend.

  • Create an interface for the API by using the swagger-specification. You can do this without using a server, see here.

  • Verify the interface by using swagger-ui. This allows you to see all the endpoints that you've defined (still, no coding, except for the json files!)

  • Once you have an interface you want, use swagger-codegen to build a stubbed-out version of your server. There are currently templates for nodejs and scalatra with more on the way. Making a new server generator is simply a matter of creating/modifying some mustache templates.

  • You can also generate your client with swagger-codegen.

The beauty of this is that you can do interface-driven development of your API. Build the interfaces and fill in the blanks. The plumbing is done for you.

WADL/WSDL 2.0 for RESTful services in Ruby on Rails

The answer is "No"; Rails does not provide a way to do this. WSDL 2.0 is arguably used by nobody, let alone by anybody doing REST (even though it's theoretically possible to a certain degree, its support for RESTful HTTP is very limited; e.g. it doesn't support hypermedia). WADL has strong acceptance problems within the REST community, too; with the exception of the Java Jersey framework, I'm not aware of any implementation.

Use Github API with rest client to create a file

So I finally found the solution to my problem!

I needed to create a json string instead of just passing the hash.

RestClient.put "https://api.github.com/repos/vernalkick/kevinclark/contents/test.txt", :params => JSON.generate(params)


Related Topics



Leave a reply



Submit