×
×

APIhub

What the client needed: 

APIhub is creating a repository of all the available APIs. They are using Swagger Codegen to convert API specs into client libraries in multiple languages. These include PHP, Java, Ruby, Python and Scala. The Swagger Codegen engine is developed in Scala and APIhub wanted to integrate their Drupal website with Swagger Codegen so that when someone submits an API spec, it automatically gets converted to client libraries and is uploaded on the Drupal website.

Solution we provided: 

Red Crackle created a service using Drupal which calls the Swagger Codegen whenever a new API spec is received. The Swagger creates client libraries and informs Drupal website of them. Drupal code then uploads these libraries so that they can be downloaded by the visitors.

Project Outcome: 

APIhub got an integrated system that automatically creates client libraries whenever a new API spec is uploaded. This reduces the work they need to do to convert each API spec into client libraries manually. Visitors can download these client libraries from their website.


APIhub is creating a website to store information and client libraries about all the available APIs. To create client libraries from API specs, they are using Swagger Codegen, which is developed in Scala. APIhub wanted to create a system that the API spec uploaded on their Drupal websites automatically gets converted to client libraries in PHP, Java, Scala, Ruby and Python and then uploaded on the website for the clients to download.

Red Crackle created a separate service server for the Swagger Codegen and put a Drupal installation there. Then we created APIs so that the main Drupal website would interface with this Swagger Codegen server and communicate information about the API specs as well as client libraries. When a API spec node is saved, an MD5 hash is generated and is stored in the main Drupal site. Whenever the node is saved again, we make sure that the hash has changed. If the hash hasn't changed, that means that the API spec hasn't changed and we don't generate new client libraries. On the other hand, if the hash has changed, the main Drupal website calls the Swagger Codegen server with the API spec. The Swagger Codegen servers received the spec and invokes Swagger Codegen, which in turn starts generating client libraries. Once the client libraries are generated, the Drupal instance on the Swagger Codegen server passes them back to the main Drupal website using a service call. The main Drupal website saves these libraries and displays them on the webpage for the visitors to download.

This automated process reduced the hours of work that needed to be done to manually convert the API specs to client libraries.

Services: