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.
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
codefolder (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
authType property will be provided. These properties will be used to the specify type of authentication
required by the API.
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.
The OpenAPI specification (formerly known as the Swagger specification) is a format used to describe and document RESTful APIs.
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 (Web Services Description Language Version) provides a model and an XML configuration used for describing web services.
WADL (Web Application Description Language) is scheme that provides a machine-readable definition of HTTP-based web applications.