Using Swagger to build your own SDK
Swagger is a set of open-source tools built around the OpenAPI Specification that can help you design, build, document and consume REST APIs.
What is Swagger?
The OpenAPI Specification, previously known as the Swagger Specification, is an API description format for REST APIs. An OpenAPI file allows you to describe your entire API, including:
- The endpoints available (for example:
/users
) and the actions that can be performed on them (for example:GET /users
,POST /users
) - Parameters for each operation, including inputs and outputs
- Authentication methods
- Contact information, license, terms of use, and other relevant information
API specifications can be written in YAML or JSON formats, which are easy to understand and use for both humans and machines.
The public API specification for data.world is available here: data.world public API.
For the complete OpenAPI Specification, visit the GitHub page: OpenAPI 3.1.0 Specification.
⚠️ Deprecation Warning ⚠️
The public API specification based on OpenAPI 2.0 is deprecated and will stop being updated on
February 15, 2025. It will remain available in the same url here until March 15, 2025.
Swagger Codegen
Swagger Codegen can simplify your build process by generating server stubs and client SDKs for the API, defined with the OpenAPI specification, so you can focus better on the API’s implementation and adoption.
Prerequisites
Download the latest stable version from Maven.org. It requires Java 7 runtime or newer:
wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.3/swagger-codegen-cli-2.2.3.jar -O swagger-codegen-cli.jar
java -jar swagger-codegen-cli.jar help
If you have a Mac or a Linux environment, then you could use Homebrew to install the Swagger Codegen:
brew install swagger-codegen
If building from source, make sure the following are installed and in your $PATH:
Usage
Following is an example command using Homebrew:
swagger-codegen generate -i https://api.data.world/v0/swagger.json -l ruby -o /path/to/dw-api-ruby
For more details on how to use Swagger Codegen, please visit official documentation.
Updated 14 days ago