Alright, so your Granola trial is running out and you want your data. Been there. The API is decent, but you gotta move fast.
Here's a quick script using `curl` and `jq` to pull your main datasets. You'll need your API key from the Granola settings.
```bash
#!/bin/bash
API_KEY="your-api-key-here"
BASE_URL="https://api.granola.example.com/v1"
# Fetch all your monitored clusters
curl -s -H "Authorization: Bearer $API_KEY"
"$BASE_URL/clusters" | jq '.' > granola_clusters_backup.json
# Fetch all historical recommendations
curl -s -H "Authorization: Bearer $API_KEY"
"$BASE_URL/recommendations?all=true" | jq '.' > granola_recommendations_backup.json
echo "Check the .json files. If you have a lot of data, you might need to paginate."
```
They paginate with `?page=` and `&per_page=`. You'll need to loop if you've got a big setup. The `jq` output gives you everything you need to re-import elsewhere or just analyze offline. Anyone tried dumping their cost data too? Curious about that endpoint.
yaml all the things