DEV Community

Cover image for Testing Integration Resilience: Validating API Availability with the Services List Endpoint
eKYC Pro
eKYC Pro

Posted on

Testing Integration Resilience: Validating API Availability with the Services List Endpoint

In modern identity verification workflows, the reliability of your integration depends on more than just handling successful responses. When building onboarding flows that rely on specific platform checks—such as verifying a phone number against Facebook or Instagram—hardcoding service availability can lead to unnecessary failures in production.

To build resilient systems, you should treat service availability as dynamic data. By integrating the Services List API, you can programmatically validate whether a specific check type is enabled before triggering a request.

Why Check Availability?

When you trigger a synchronous check for a user identifier, your application expects a specific signal. If a provider is temporarily unavailable or a service type is toggled off, your integration might encounter unexpected errors. By checking the services list first, you can implement a graceful fallback or inform the user that a specific verification method is currently unavailable, rather than failing the entire onboarding process.

Implementing a Pre-Flight Validation Check

Before executing a check, query the GET https://api.ekycpro.com/v1/services endpoint to confirm the status of your required services.

Step 1: Query the Services List

Perform a request to the services endpoint to retrieve the current status of all supported check types.

curl --location 'https://api.ekycpro.com/v1/services'
Enter fullscreen mode Exit fullscreen mode

Step 2: Parse and Validate

The response provides a list of services with an enabled boolean flag. Your application logic should filter this list to find the service you intend to use.

{
 "success": true,
 "services": [
 { "type": "facebook", "data_type": "phone", "enabled": true },
 { "type": "instagram", "data_type": "phone", "enabled": true }
 ]
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Integrate into Your Workflow

Before calling your verification endpoint, verify that the enabled field is true for your target service. If the service is disabled, your application can skip that specific check or notify the user to try a different verification method.

Testing and Sandboxing

To ensure your integration handles service outages gracefully, incorporate the following testing patterns:

  1. Mocking Responses: In your test environment, create fixture files that simulate the services response with enabled: false. This allows you to verify that your application correctly handles the "service unavailable" state without needing to trigger a real API call.
  2. Contract Testing: Use the documented response structure to validate that your integration layer correctly parses the type and enabled fields.
  3. Negative Testing: Programmatically simulate a scenario where the API returns success: false or an empty services list to ensure your error handling logic is robust.

Conclusion

By treating service availability as a dynamic check rather than a static assumption, you can significantly improve the resilience of your onboarding flows. Use the Services List API to create a proactive validation layer that protects your application from unnecessary failures and provides a smoother experience for your users.

For more details on integrating these checks, visit the official documentation.

This article was drafted with AI assistance and reviewed before publishing.

Top comments (0)