> ## Documentation Index
> Fetch the complete documentation index at: https://docs.avert.ldeo.columbia.edu/llms.txt
> Use this file to discover all available pages before exploring further.

# API Testing Alternatives

> Reliable ways to test the AVERT Imagery API when the playground has display issues

## Interactive Testing Alternatives

**The Issue**: While the AVERT API now returns JSON by default, the playground may still have display limitations with large responses.

**The Solution**: Use these reliable testing methods for the best experience with the improved API.

Here are the best alternatives for testing:

### 1. **Browser-Based Testing**

**Postman** (Recommended):

1. Download [Postman](https://www.postman.com/)
2. Create a new GET request to: `https://avert-legacy.ldeo.columbia.edu/api/imagery/infrared/query`
3. Add parameters:
   * `site`: `CLNE`
   * `vnum`: `311240`
   * `search_from`: `2024-05-30T12:00`
   * `search_to`: `2024-05-30T14:00`
4. Click **Send** - you'll see beautiful JSON formatting!

### 2. **Command Line Testing**

<CodeGroup>
  ```bash quick-test.sh theme={null}
  curl -s "https://avert-legacy.ldeo.columbia.edu/api/imagery/infrared/query?site=CLNE&vnum=311240&search_from=2024-05-30T12:00&search_to=2024-05-30T14:00&limit=10" | jq .
  ```

  ```bash formatted-with-headers.sh theme={null}
  curl -H "Accept: application/json" \
       -H "User-Agent: AVERT-API-Test" \
       "https://avert-legacy.ldeo.columbia.edu/api/imagery/infrared/query?site=CLNE&vnum=311240&search_from=2024-05-30T12:00&search_to=2024-05-30T14:00&limit=10" | jq .
  ```
</CodeGroup>

**Using the limit parameter**: The API now supports a `limit` parameter to control result size for better testing!

### 3. **Python Testing**

<Tabs>
  <Tab title="Simple Test">
    ```python theme={null}
    import requests
    import json

    # Test infrared imagery query with limit
    response = requests.get(
        "https://avert-legacy.ldeo.columbia.edu/api/imagery/infrared/query",
        params={
            "site": "CLNE",
            "vnum": 311240,
            "search_from": "2024-05-30T12:00",
            "search_to": "2024-05-30T14:00",
            "limit": 10  # Control result size
        }
    )

    print(f"Status: {response.status_code}")
    print(f"Found {len(response.json())} images")
    print("\nFirst image:")
    print(json.dumps(response.json()[0], indent=2))
    ```
  </Tab>

  <Tab title="Complete Testing Script">
    ```python theme={null}
    import requests
    import json
    from datetime import datetime

    def test_avert_api():
        """Test both infrared and visible imagery endpoints"""

        base_params = {
            "site": "CLNE",
            "vnum": 311240,
            "search_from": "2024-05-30T12:00",
            "search_to": "2024-05-30T14:00",
            "limit": 10  # Control result size for testing
        }

        endpoints = {
            "infrared": "https://avert-legacy.ldeo.columbia.edu/api/imagery/infrared/query",
            "visible": "https://avert-legacy.ldeo.columbia.edu/api/imagery/visible/query"
        }

        for name, url in endpoints.items():
            print(f"\n=== Testing {name.title()} Imagery ===")

            try:
                response = requests.get(url, params=base_params, timeout=30)
                response.raise_for_status()

                data = response.json()
                print(f"Status: {response.status_code}")
                print(f"Results: {len(data)} images")

                if data:
                    print(f"Time range: {data[0]['timestamp']} to {data[-1]['timestamp']}")
                    print(f"Example image: {data[0]['image_id']}")

            except requests.RequestException as e:
                print(f"Error: {e}")
            except json.JSONDecodeError as e:
                print(f"JSON Error: {e}")

    if __name__ == "__main__":
        test_avert_api()
    ```
  </Tab>
</Tabs>

### 4. **JavaScript/Browser Console**

Open your browser's developer console and run:

```javascript theme={null}
// Test the API directly from browser
fetch(
  "https://avert-legacy.ldeo.columbia.edu/api/imagery/infrared/query?site=CLNE&vnum=311240&search_from=2024-05-30T12:00&search_to=2024-05-30T14:00&limit=10"
)
  .then((response) => response.json())
  .then((data) => {
    console.log(`Found ${data.length} images`);
    console.table(data); // Nice table display
    return data;
  })
  .catch((error) => console.error("Error:", error));
```

## Expected Results

When testing with our recommended parameters, you should see:

* **Status**: `200 OK`
* **Results**: \~10 infrared images (controlled by limit parameter)
* **Format**: Clean JSON array with image metadata
* **Response time**: Usually \< 2 seconds

## Still Having Issues?

If you're having trouble with any of these methods:

1. **Check your internet connection**
2. **Verify the AVERT API is online**: Visit [avert-legacy.ldeo.columbia.edu](https://avert-legacy.ldeo.columbia.edu)
3. **Try a different date range**: Use recent dates within 2024
4. **Contact support**: Email [avert-system@proton.me](mailto:avert-system@proton.me)

The API itself is robust and reliable - these alternatives will give you the full experience that the playground aims to provide.
