Blog
With the imminent release of Zato 3.2, we are happy today to announce the availability of a new [API integrations tutorial]/en/docs/3.2/3.2/tutorial/01.html). Let's quickly check what it offers.
The tutorial is completely new and by following it, you will learn all of the following:
What is Zato and how it can be used as an API integrations platform and backend application server
How to think in terms of reusable API services
Zato installation under several platforms, including Linux distributions, Docker and Vagrant
Using PyCharm, Visual Studio Code and other IDEs with Zato
Developing Zato services and using its Dashboard for configuration
How to integrate with external systems, using REST and AMQP as example technologies
How to automate deployments
How to conduct automated API tests in plain English, without any programming
In short, after you complete it, you will acquire the core of what is needed to use Python to integrate complex API and backend systems.
# -*- coding: utf-8 -*-
# zato: ide-deploy=True
# Zato
from zato.server.service import Service
class GetUserDetails(Service):
""" Returns details of a user by the person's ID.
"""
name = 'api.user.get-details'
def handle(self):
# For later use
user_name = self.request.payload['user_name']
# Get data from CRM ..
crm_data = self.invoke_crm(user_name)
# .. extract the CRM information we are interested in ..
user_type = crm_data['UserType']
account_no = crm_data['AccountNumber']
# .. get data from Payments ..
payments_data = self.invoke_payments(user_name, account_no)
# .. extract the CRM data we are interested in ..
account_balance = payments_data['ACC_BALANCE']
# .. optionally, notify the fraud detection system ..
if self.should_notify_fraud_detection(user_type):
self.notify_fraud_detection(user_name, account_no)
# .. now, produce the response for our caller.
self.response.payload = {
'user_name': user_name,
'user_type': user_type,
'account_no': account_no,
'account_balance': account_balance,
}