# Retrieving the Latest Results for Scheduled Tests with the NetBeez API

**URL:** <https://community.netbeez.net/t/retrieving-the-latest-results-for-scheduled-tests-with-the-netbeez-api/145>\
**Category:** APIs & Developer Support\
**Tags:** api\
**Created:** [January 19, 2024, 3:47am UTC](https://community.netbeez.net/t/retrieving-the-latest-results-for-scheduled-tests-with-the-netbeez-api/145 "2024-01-19T03:47:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![panickos](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.netbeez.net/panickos/32/8_2.png) [@panickos](https://community.netbeez.net/u/panickos)\
**Post date:** [January 19, 2024, 3:47am UTC](https://community.netbeez.net/t/retrieving-the-latest-results-for-scheduled-tests-with-the-netbeez-api/145/1 "2024-01-19T03:47:56Z")

</div>

**Want to quickly access the most recent results for each agent running a scheduled test?** The NetBeez API makes it a breeze! In this guide, we’ll walk you through the process of retrieving the latest results using the API.

**Prerequisites:**

- Access to the NetBeez BeezKeeper API.
- A tool to make API calls (e.g., Postman, curl, or a Python script).

**Steps:**

1. **Identify the Scheduled Test Template ID:**
  - Navigate to the Scheduled Tests section of your NetBeez dashboard.
  - Find the scheduled test you’re interested in.
  - Note the ID associated with the test template.

2. **Construct the API URL:**
  - Use the following base URL, replacing `{{HOSTNAME}}` with your BeezKeeper hostname: `https://{{HOSTNAME}}/scheduled_nb_test_templates/:scheduled_nb_test_template_id/results?filter[last_result]=true`
  - Replace `:scheduled_nb_test_template_id` with the ID you obtained in step 1.

3. **Authorize Your API Call:**
  - Include an authorization header with your API token in the API call.

4. **Make the API Request:**
  - Use your chosen tool to send a GET request to the constructed URL.

5. **Process the Response:**
  - The API response will provide a JSON object containing the latest results for each agent running the scheduled test.
  - Parse the JSON data to extract the information you need.

**Example (Python):**

```python
import requests

BASE_URL = "https://your-beezkeeper-hostname" # Replace with your hostname
API_TOKEN = "your-api-token" # Replace with your API token
SCHEDULED_TEST_TEMPLATE_ID = "123" # Replace with the template ID

url = f"{BASE_URL}/scheduled_nb_test_templates/{SCHEDULED_TEST_TEMPLATE_ID}/results?filter[last_result]=true"
headers = {'Authorization': f'Bearer {API_TOKEN}'}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    data = response.json()
    # Process the JSON data here
else:
    print("Error:", response.status_code)

```

**Additional Tips:**

- Use the `page[limit]` and `page[offset]` parameters to paginate through results if necessary.
- Refer to the official NetBeez API documentation for more details and options: [https://api.netbeez.net](https://api.netbeez.net/)

**Happy result fetching!**
