Consuming an API schema
When you consume an API schema in Martini, a Gloop 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 Gloop service which also allows you to invoke a web service in your code.
Martini supports the following API schemas for consumption:
To generate Gloop services from an API schema:
Launch the Gloop API wizard.
- 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 New, then select Gloop API.
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.
- Specify your source API schema.
- Browse for the API specification document in the file system or enter its URL in the text box.
- Specify your API schema's type by selecting any of the options in Source, if Coder hasn't selected the correct one for you.
- Specify if you want to log your services' requests to Tracker.
- 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 Gloop 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.