How to report and API bug?

Hey folks,
I’m testing some APIs and have come across a few failed responses.
What exactly should I report to the developer?
Also, do you have any templates or examples I could use?

Thanks a lot!

It’s pretty much like any other bug report:

  1. specify which API call is giving a incorrect response, and then detail under what scenarios it produces different or other responses. It’s important to capture either different preconditions that affect the reply, or different parameters that affect the reply.
  2. Describe the response you expected.

I log API bugs the same really as any bug but the only difference for me, is that I go and look for other API’s that are either similar to or related somehow, to see if those API’s also exhibit issues. This can help the developers to fix them all in one go or help them to fix the bug more quickly if you have described some test scenarios.

Finally, I write a failing automated test, and check it into the CI setup so that the test fails, either until the bug gets fixed, or you get told that it’s wrong by design or something else. That way I have a failing test that will pass once the bug gets sorted out. Sometimes the automated test will need extending later on after a fix is delivered, but it’s a good reason to have a failing test in your CI/CD run. After the bug is fixed you can then easily evolve and stress test that API call.

4 Likes

If you can’t do as @conrad.braam suggests and write a failing test - you might be testing an external API - then you could try and recreate the API issue as a cURL command and then include that in any bug report to make the problem easier to recreate.

Most of the API clients have the ability to export requests to cURL.

6 Likes

:plus: 1 To both suggestions.

Capturing the request provides lots of great information just like the failing test.

When raising the bug, highlight any VPNs or corporate software that may have been running on your machine at the time. If the test fails in CICD then capture that info in case there are firewall / networking things at play.

3 Likes

In addition to creating an automated tests or a cURL that reproduces the issue, also provided your expectations (the response, it status code, headers, payload, etc.)

1 Like

We usually add the following details while reporting an API Bug :

Application ID / Order ID, whichever is available

  • The microservice in which the error occurred

  • Request I send

  • Error message I received

  • Screenshot or link of the api documentation for the same.

  • If the api is failing on the frontend, then curl, end path, screenshot, payload ,and response