Articles in this section

Test and debug your API using API builder

You can debug an API in test mode to ensure the API processes your records as expected before deploying the API to production. When you run an API in test mode, you can review the processing behavior of each step (transformation, mapping, filter, or hook) and fine-tune your configurations to handle all variations of results or responses from each step.

Before performing test runs, you must:

The API test run logs will include the headers, query parameters, and path parameters provided in the mock data. Similar to the test mode in the Flow builder, you can view test run results for each step and the execution logs for the steps and hooks.

Run a test

Run test is disabled if any of the following are true:

  • If the HTTP method and Relative URI are not configured in the API request.

  • If mock data is not available in the API request, except for APIs using the GET method.

  • If the HTTP status code is not configured in the API response.

You can run a test using one of two ways:

  • Click Run test at the top right of the API builder

  • Click Run test in the Run console panel

Test_mode_buttons.png

The Run console

You can watch an API as it's running and access the errors as they are reported (even before the API run has been completed) using the Run console. The top half of the page shows the API configuration, and the Run console appears on the first tab below. You can see detailed information for each step in the API as it runs.

Note

The Run console reflects the status of the most recent run or the run currently in progress. If you begin to resolve errors, this is NOT reflected in the error counts.

Run_console.png

Review test run results and errors

Reviewing the error messages and codes provided during the test run is extremely important. These messages often contain specific details about what went wrong and where. By thoroughly analyzing test run errors, you can proactively resolve issues, optimize your API, and ensure it works as expected before deployment.

You can perform debugging for every step of your API, including the request and responses, branches, lookups, and imports. Look for the blue T that designates a test run log as available for that step.

View your test run error logs

To view your test run errors:

  1. Use the Test run Run_flow.svg button to run a test.

  2. After completing your test, review the Run console to see where your errors occurred.

    Run_console_highlight.png
  3. Click the error button or the blue T in the step to open the Test run errors window. In steps where only the blue T appears instead of the error indicator, you'll need to open the step first; then, use the View debug logs button to open the logs for the step.

    API_lookup_error.png
    view_debug_logs_button.png
  4. Review your errors.

    test_run_errors.png

Cancel a test run

During the test run, the Run test button is replaced with a Cancel test run button. Click Cancel test run to abort the test run.

If a test run takes over 100 seconds, the system displays a message due to the long processing time. You can either cancel the run or wait for it to complete.

To avoid system performance issues, the test run will be auto-canceled in the following scenarios:

  • if the API runs longer than two minutes

  • Uncaught exceptions

Delete test run data

Test run data is automatically deleted in the following scenarios:

  • When your Celigo platform session expires

  • On running the next test flow in the same session

  • On navigating away from the Flow builder

  • On changing the URL

Other test mode considerations

Keep in mind these important tips to get started with test mode:

  1. Always add mock response data to each destination step before you run your first test. Otherwise, dummy data will auto-populate the first run, which will not provide accurate test results. You can add mock response data either by...

    • Clicking Populate with live data inside a destination’s mock response panel (running the import can result in records being updated or created)

    • Entering your own data from the app’s API documentation (must include statusCode)

  2. Test results will not change until the next test run, even if you modify the API configuration.

  3. Test results will be cleared and are not saved if you navigate away from your API, refresh, run a new test, or enable your flow.