Blog
A sample business model to be implemented may look like this:
Here is a a sample service that fulfils this model. Note that we are skipping its actual implementation in the handle
method because it does not influence the process of exporting it to OpenAPI or API specifications.
# -*- coding: utf-8 -*-
# stdlib
from dataclasses import dataclass
# Zato
from zato.common.typing_ import list_
from zato.server.service import Model, Service
# ###########################################################################
@dataclass(init=False)
class Phone(Model):
imei: str
owner_id: int
owner_name: str
# ###########################################################################
@dataclass(init=False)
class GetPhoneListRequest(Model):
client_id: int
@dataclass(init=False)
class GetPhoneListResponse(Model):
phone_list: list_[Phone]
response_type: str
# ###########################################################################
class GetPhoneDetails(Service):
class SimpleIO:
input = GetPhoneListRequest
output = GetPhoneListResponse
def handle(self):
# Skipped implementation
...
# ###########################################################################
Use zato openapi from command line to export services to OpenAPI:
Invoke them in Postman or other OpenAPI-compatible tools:
Use zato apispec from command line to generate full API specifications, including both a static HTML site as well as OpenAPI.
Main page:
Details of a particular service:
Book a demo with an expert who will help you build meaningful systems that match your ambitions
"For me, Zato Source is the only technology partner to help with operational improvements."