Consuming an API schema
When you consume an API schema in Martini, a service is generated for every web service/operation defined in the schema. You can then use these generated services to build your applications.
Want to consume a RESTful web service?
It's possible to consume a RESTful web service using these steps. This process generates a service which also allows you to invoke a web service in your code.
Aside from services, this process also produces associated Gloop models, and a Gloop API (optional) for cases where you want to publish the consumed API in Martini.
Martini supports the following API schemas for consumption:
To generate services from an API schema:
- Launch the Gloop API wizard.
To Create API
1 2 3 4 5 6 7 |
|
Launch the wizard using keyboard shortcuts only
You can open the Gloop API wizard by pressing ( in Martini Online), typing
"api"
in the appearing dialog's search box, and selecting Gloop API from the appearing options.
To Consume API
- Go to the Navigator view.
- Right click on your target package's
code
folder (or any of the code directories under it) where you'd like your services to reside. - Select Consume API
- Provide the source and url of the API
- Click Finish.
Consuming a secured API schema
Martini supports two ways to secure a RESTful API: basic authentication and OAuth2. Requests to secured RESTful APIs require authentication credentials in order to gain access. These credentials are validated by the server per request.
When consuming a secured API schema, generated services will have corresponding input properties and a value
to the authType
property will be provided. These properties will be used to the specify type of authentication
required by the API.
Swagger v2.0
The Swagger specification is a format used to describe and document RESTful APIs. Swagger is a popular choice amongst developers and companies primarily because of the following benefits, mentioned in the article "What is Swagger and Why it Matters":
- It's comprehensible for developers and non-developers.
- It's human readable and machine readable.
- It's easily adjustable.
Companies like Netflix, IBM, and Yelp have already incorporated it into their own infrastructure and platform.
OpenAPI v3.0
The OpenAPI specification (formerly known as the Swagger specification) is a format used to describe and document RESTful APIs.
The OpenAPI specification is overseen by the OpenAPI Initiative which aims to standardize API descriptions. Google, Microsoft, and IBM are members of this initiative.
Postman collection
The Postman collection format is the API format for use with Postman.
Postman collection version
Martini only supports v2.1 of the Postman collection format. If you encounter errors or have a collection file that's not v2.1, you can:
- Import the collection into Postman.
- Export the collection again, choosing Collection v2.1 as the format.
WSDL
WSDL (Web Services Description Language Version) provides a model and an XML configuration used for describing web services.
WADL
WADL (Web Application Description Language) is scheme that provides a machine-readable definition of HTTP-based web applications.
RAML
RAML stands for RESTful API Modeling Language. It's a YAML-based language used for describing RESTful APIs in a way that's highly machine and human readable.