💻 Terminal, HTTP & Your First API Call — app1.4
Developer CourseModule 1: Terminal, HTTP & Your First API Callapp1.4
Reading10 min

Your First API Call: curl to EnergyAtIt

💻 Module 1: Terminal, HTTP & Your First API Call

Your First API Call: curl to EnergyAtIt

Let's make your first real API call. Right now.

Step 1: Get Your API Key

Go to app.energyatit.com/developers and create a sandbox account. You will get an API key that looks like:

eat_test_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6

The eat_test_ prefix means it's a sandbox key — safe to experiment with.

Step 2: Check the Server Is Alive

# Health check — no API key needed
curl https://app.energyatit.com/api/v1/health
# Health check — no API key needed
curl.exe "https://app.energyatit.com/api/v1/health"

You should see:

{
  "success": true,
  "data": { "status": "healthy", "version": "1.0.0" }
}

Step 3: List All Sites

# Replace YOUR_API_KEY with your actual eat_test_ key
curl -H "Authorization: eat_test_YOUR_KEY_HERE" \
  https://app.energyatit.com/api/v1/sites
# Replace YOUR_API_KEY with your actual eat_test_ key
curl.exe -H "Authorization: eat_test_YOUR_KEY_HERE" "https://app.energyatit.com/api/v1/sites"

Step 4: List Assets for a Site

curl -H "Authorization: eat_test_YOUR_KEY_HERE" \
  https://app.energyatit.com/api/v1/assets?site_id=1
curl.exe -H "Authorization: eat_test_YOUR_KEY_HERE" "https://app.energyatit.com/api/v1/assets?site_id=1"

Step 5: Get Meter Readings

curl -H "Authorization: eat_test_YOUR_KEY_HERE" \
  https://app.energyatit.com/api/v1/grid-connections/1/readings
curl.exe -H "Authorization: eat_test_YOUR_KEY_HERE" "https://app.energyatit.com/api/v1/grid-connections/1/readings"

What Just Happened

You just:

  1. Verified the server is alive (health check)
  2. Listed energy sites (GET /sites)
  3. Listed devices at a site (GET /assets)
  4. Read live meter data (GET /readings)

That is the foundation of every energy app ever built. Read data from devices.

Troubleshooting

  • 401 error: Your API key is wrong. Check for typos.
  • Connection refused: Check your internet. Try curl ifconfig.me first.
  • No data: The sandbox might need provisioning. Hit POST /api/v1/sandbox/provision first.

Log in to track your progress and earn certifications.