Wednesday, January 13, 2021

Zato Blog: How to integrate API systems in Python

With the immenent release of Zato 3.2, we are happy today to announce the availability of a new API integrations tutorial. Let's quickly check what it offers.

The tutorial is completely new and by following it, you will learn all of:

  • 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 distrubutions, 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.

Zato tutorial
# -*- 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,
      }
Zato tutorial
Zato tutorial

Click here to get started - and remember to visit our Twitter, GitHub and Gitter communities as well.



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...