Citrix Blogs

Best practices for validating your APIs against company guidelines

As you read in my last post, defining API guidelines for your company is a great first step to ensure success. For effective adoption, you have to disseminate the guidelines across teams through training and support the intent behind them with consistent messaging. Making API guidelines compliance part of a release’s checklist can help to get a team’s attention early and ensure work gets started on the right foot.

It’s helpful for API developers to get feedback on whether their API design and implementation comply with company guidelines. Checklists can be useful for tracking a small number of items, but for a list with hundreds of line items, they can become unwieldy.

Going through the list manually and assessing each item isn’t easy. That’s where automating validation and feedback can come in handy.

I recommend using the following three validation approaches to checking whether your APIs are compliant with company guidelines:

You can manage static and dynamic validation through automation, and you can handle the manual review with a well-defined process. Let’s take a look at each in more detail.

STATIC VALIDATION AUTOMATION

Static validation automation is most valuable during the design phase, when it’s important to provide feedback to the API designer on the API spec. The goal is to have a tool like JSONLint, where the API developer can paste the API spec and get feedback on what’s inconsistent with the guidelines (and even tips to correct common mistakes). A GUI-based tool like JSONLint is easy to use, but you need to have first-class API support for validation so your APIs can be integrated into continuous integration pipelines.

One approach we’ve taken is shown here:

DYNAMIC VALIDATION AUTOMATION

Once the API implementation begins and there are tests written for it, we can start running the dynamic validation tests. Unlike static validation, which works only out of the API spec, here we need actual API endpoints and tests to exercise the endpoints and we must introspect the input/output payloads. This validation approach is not amenable to manual input/output. The ideal way to do this is to integrate it with the functional testing of the API.

One approach we’ve taken is shown here:

Manual Review

With manual review, we need to define a process and workflow in the tracking tool. Like with any other process, it should be simple. It should also scale when more APIs are brought into the fold. For example, instead of having a centralized approval committee, which can become a bottleneck in large organizations, it’s better to have a distributed and federated approval process.

Our approach for defining a workflow is shown below.

Keep an eye out for our next post, where we’ll take a look at other capabilities that constitute a complete API platform and how they related to each other. And check out my posts on API experience and defining API guidelines for your company.

Exit mobile version