Skip to content

Amber API process #196

Answered by madpilot
petebitt99 asked this question in Q&A
Mar 12, 2024 · 2 comments · 21 replies
Discussion options

You must be logged in to vote

Looks like it's just a straight up Node-based JavaScript script.

Something like this should get you started:

const apiKey = 'psk_f31a4b0b3ee67b8db63067a7d0385bd0'
const siteId = '01H92N0GC70BAZHM48P2C52J3M'

const response = await fetch(`https://api.amber.com.au/v1/sites/${siteId}/prices/current`, { 
  headers: { 
    'Authorization': `Bearer ${apiKey}` 
  } 
}
const prices = await response.json()
const generalPrice = prices.find((price) => price.channelType === 'general')?.perKwh
const feedInPrice = prices.find((price) => price.channelType === 'feedIn')?.perKwh

Replies: 2 comments 21 replies

Comment options

You must be logged in to vote
20 replies
@petebitt99
Comment options

@madpilot
Comment options

@petebitt99
Comment options

@madpilot
Comment options

Answer selected by petebitt99
@petebitt99
Comment options

@petebitt99
Comment options

@madpilot
Comment options

@petebitt99
Comment options

Comment options

You must be logged in to vote
1 reply
@madpilot
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants