Help with setting a context variable from HTTP response

For the longest time, I have been using the NWS API to pull temperature values and setting a variable ($ExtTempC). Some time within the last few months, this stopped working and it appeared initially to be related to the header requirement to use the API. I added the header per their requirements and get valid authentication but I am unable to set this variable. I am by no means a pro when it comes to coding language so looking for some assistance in helping me troubleshoot the issue. Thanks! -Ryan

That API endpoint is returning a massive 2MB payload which is probably a major contributor to the issues.

If you are only using the ‘latest’ value from the API response, it looks like you can append /latest to the API URL and it’s a way smaller response. You would also need to update the JSON path you are grabbing to remove the features[0] since /latest returns the latest feature directly.

https://api.weather.gov/stations/KGLS/observations/latest

Set variable using expression:

$context.response.data.properties.temperature.value

1 Like

My man :smiling_face_with_sunglasses: Thanks so much, Josh!

1 Like