# Web & API integration

**Overview**

The "Web & API Integration" feature in our automated testing framework bridges the gap between web-based testing and API interactions. This integration allows for the seamless execution of API calls during web tests, enhancing the ability to test complex scenarios that involve both front-end and back-end components.

**How It Works**

When the testing framework encounters the `API_EXECUTOR` action in the CSV configuration, it triggers an API call. The framework searches for the specified API file in the test data directory and executes the API request. The data retrieved from this API call can be stored in global variables or processed further using "API Tailor-Made Coding".

**CSV File Configuration for Web & API Integration**

To incorporate an API call into your test, use the following format in the CSV configuration:

* **Example Entry**:

  ```
  PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
  NONE,NONE,NONE,NONE,API_EXECUTOR,ApiFileName,NONE,NONE
  ```
* **Key Columns**:
  * `ACTIONS`: Set to `API_EXECUTOR` to indicate an API call.
  * `SEND_KEYS`: Specifies the name of the API file to be executed.

**Utilizing API Data in Tests**

The data obtained from the API call can be leveraged in several ways:

1. **Stored in Global Variables**:
   * Data from the API response can be automatically stored as global variables.
   * **Use Case**: This is useful for scenarios where API response data is needed in subsequent web test steps.
2. **API Tailor-Made Coding**:
   * Custom code can process the API response data as per specific test requirements.
   * **Use Case**: When the standard processing of API data is not sufficient, custom methods can manipulate or utilize this data in a tailored manner.

**Benefits**

* **Comprehensive Testing**: Allows for testing scenarios that involve both the user interface and API interactions, providing a more thorough test coverage.
* **Efficiency**: Reduces the need for separate tests or manual integration of API and web testing.
* **Flexibility**: Offers the ability to customize how API data is used and processed within the testing process.

**Conclusion**

The "Web & API Integration" feature significantly enhances the capabilities of our automated testing framework. By enabling the execution of API calls within web tests and providing mechanisms for the efficient handling of API data, it allows testers to create more sophisticated and comprehensive test scenarios, ensuring a thorough validation of both front-end and back-end functionalities.


---

# 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.precisiontestautomation.in/scriptlessautomation/automation-platforms/scriptlessweb-automation/web-and-api-integration.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.
