# API Tester

he *API Tester* in Spark is targeted to two types of users to interact with the converted Excel to API logic:

1. Business users who own the Excel spreadsheet and logic. The *API Tester* is essentially a calculator for the model, allowing users to conduct interactive form-based unit testing on their models to ensure they function as intended.
2. Developers who need to understand how to integrate with the API.

To access this feature, after choosing a specific service from [Folder overview](/navigation/folder-overview.md), choose the ![](/files/GJCMu18zQPxxtrZLf9Yz)*API Tester* icon from the service sidebar.

## Testing

The first tab within the API Tester is the *Testing* tab. This provides the capability to make API requests against the converted Excel logic.

### Submit API requests

1. By default the API Tester displays inputs in the *Field view*.
2. The input fields will contain the default values from the Excel file.
3. Enter the desired values for the inputs. Spark will present an appropriate interface based on data type, including:
   * dropdown menus or radio buttons for single-cell fields with Excel data validation.
   * raw text boxes for CSV inputs.
   * a grid interface for multiple-cell ranges. (The dimensions of the multiple-cell range depend on the dimensions of the default values in Excel.)
4. Click the **Submit** button to execute the API call.

{% hint style="info" %}
If the Spark service contains dynamic validations that meet the [Validation API](/spark-apis/validation-api.md#pre-requisites-for-dynamic-validations), changes to an inputs will automatically trigger an update to any associated inputs, e.g. choosing a `Country` can change a `City` list.
{% endhint %}

#### Select the API request and API response view

| Key            | Value                                                                                                                                                                                              |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *Field view*   | <p>The default view.</p><p>The inputs and outputs appear in the format of a form.</p>                                                                                                              |
| *JSON view*    | <p>The API request and API response displayed in a JSON viewer, which makes it easier to traverse through the JSON objects.<br>This view is read-only. Objects can be copied to the clipboard.</p> |
| *Raw view*     | The request body, displayed as editable plain text.                                                                                                                                                |
| *cURL Command* | Enter a cURL command here to provide the API request body.                                                                                                                                         |

#### Change the service version called and the API specification type

* At the top of the API Tester page, you can choose the service version to test.
* The default *API format* is `V3`, however you can select the legacy `V1` API if needed.

### Review API responses

* After the execution of the API is complete, the results appear in the API response area.
* The *View Log* button will navigate to [API Call History](/navigation/api-call-history.md).

#### Download the Excel file with inputs and formatted outputs

Business users may want to review the specifics of an API call in Excel to review the calculation. Download a copy of the Excel file by clicking the ![](/files/5twQcw9yTnyF9BnuPYcd) *Download the API response as Excel file*.

* Spark will populated input ranges such as `Xinput` with the fields from the API request.
* Spark will not populate output ranges such as `Xoutput` with the fields from the API response. This is to preserve the original formulas.
* Spark will add tabs containing the formatted API response outputs.

### Adjust service parameters

Changing the service parameters affects the API request [Execute API (v3)](/spark-apis/execute-api/execute-api-v3.md#request_meta) parameters. Most users shouldn't need to modify the entries in this section.

| Key                | Value                                                                                                                                                                                       |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *Endpoint URL*     | Find out more in [Execute API (v3)](/spark-apis/execute-api/execute-api-v3.md#uri).                                                                                                         |
| *Custom endpoint*  | Find out more in [Custom endpoints](/spark-apis/execute-api/custom-endpoints.md).                                                                                                           |
| *Service type*     | Defines the version of the Excel engine used by Spark. [Neuron](/build-spark-services/neuron.md) is the default for all new services uploaded to Spark.                                     |
| *Requested output* | Used to filter the API response outputs. Find out more in [Execute API (v3)](/spark-apis/execute-api/execute-api-v3.md#request_meta) under `requested_output` and `requested_output_regex`. |
| *Subservices*      | Used to select the [How to: Work with subservices](/build-spark-services/subservices.md) to include in the request.                                                                         |

## Integration

The *Integration* tab provides code snippets to help integrate the Spark API with applications.

### Swagger

* "[Swagger](https://swagger.io/about/) is a powerful yet easy-to-use suite of API developer tools for teams and individuals, enabling development across the entire API lifecycle, from design and documentation, to test and deployment."
* Many low-code platforms can ingest Swagger specifications for API integration.
* There is also an option to [#change-the-service-version-called-and-the-api-specification-type](#change-the-service-version-called-and-the-api-specification-type "mention").
* The Swagger statement from Spark formats the elements that form the API [Execute API (v3)](/spark-apis/execute-api/execute-api-v3.md#request_data).
* The "Swagger (Form data)" format includes additional information about field enumeration and validation.

{% hint style="info" %}
The Swagger structure and values may differ depending on the service version and API format chosen.
{% endhint %}

### Code Snippets

The *Code Snippet* tab provides sample code to help you make API requests from outside of Spark.&#x20;

* Code snippets are available in 25+ programming languages (such as cURL, go-Native, Python, JavaScript, etc.) and can be copied to the clipboard or downloaded with one click.
* The OpenAPI option includes a comprehensive details about the [Execute API (v3)](/spark-apis/execute-api/execute-api-v3.md) parameters.

{% hint style="info" %}
The default language in the dropdown menu is cURL, but Spark remembers the last language chosen.
{% endhint %}

## Documentation

The *Documentation* tab automatically generates an API specification document for your API. It describes the authorization methods and input and output parameters and contains a sample request and response.

You can customize the document in the rich text editor and then export it as a PDF or HTML file.

{% hint style="warning" %}
Always remember to export your document before refreshing or navigating away from the page. Any edits made in the rich text editor will not be saved!
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coherent.global/navigation/api-tester.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
