In his Writing Made Easy SnakeByte, our own Alec Macrae wrote about Python's speed of development stemming from easily importable third party modules and extensive support libraries. What makes these libraries even more powerful is when they wrap sets of APIs. As a healthcare API company, of course we understand RESTful APIs, but we also focus a good deal on API wrappers or API clients, both internally and externally.
We use API clients internally as a function of our business process. For instance, we use Salesforce extensively and one of the things we want to persist is data surrounding API signups. When folks sign up for a Platform App, we want to funnel this information into Salesforce queues for our Business Development and Application Success teams.
Salesforce has done a solid job of providing REST APIs for manipulating all of the data in their CRM. Additionally, there is an open source simple-salesforce Python library that abstracts these API calls, allowing us to access the full functionality of the Salesforce APIs as objects and functions, constructs we utilize throughout our codebase. This very distilled snippet utilizes the simple-salesforce library to show how we would create a Lead object in Salesforce.
But these few lines are merely the tip of the iceberg in terms of the actual code necessary to support the API calls to Salesforce. So we wrote our own application specific libraries that encapsulate this call to create a Lead, as well as application logic, database document retrieval, session management with Salesforce, configuration of whether to use a Salesforce Sandbox, data verification, exception handling, logging, and other sundry items. Our application API client wraps all of these things and this allows, in this case, the signup processing code to persist the Lead information, as well as the corresponding Platform App as a separate custom object in Salesforce. This is not a distillation, but is in fact, actual code.
This code can be called from inside the Platform form handlers, or from a Kafka consumer listening for Sign Up Events. But neither need know any of the details of how to ferry data across to Salesforce using their REST APIs. In addition to integrating with Salesforce, we've written similar API clients for JIRA, Marketo, and HubSpot. In doing so, it allows us to focus on the immediate application concerns at hand and ship our code faster.
PokitDok offers the same benefits of streamlined development to our customers, who are also developers. We created a python API client that allows them to access the full functionality of our Platform APIs as objects and functions. The process of creating an OAuth session, making an HTTPS request to an API endpoint, and digesting the corresponding response are all conveniently abstracted away within the API client itself. In order to perform an eligibility check for a patient using their game-changing application, developers simply need to write a few lines of code like this:
Employing PokitDok's Python API client saves developers hours of engineering and allows them to keep their code base focused on parsing the JSON payload, rather than worried about refreshing session access tokens on timeout.