A Second Helping of REST APIs
We’ve been dining on REST APIs served up by PowerShell. I hope you got a chance to try out the code examples from the previous article. I want to continue serving up delicious PowerShell recipes for getting the most from a REST API.
Let’s continue our exploration and experimentation with another free API that you can access at https://sunrise-sunset.org. The API documentation can be found at https://sunrise-sunset.org/api. This API is completely free and does not require an API key. I am using it for educational purposes. At a minimum, you need the location’s latitude and longitude. The API will default to the current date, or you can specify a date in the Year-Month-Day format.
$date = Get-Date -Format yyyy-MM-dd
The format string is case-sensitive. In the previous article, I shared a function using another REST API to get a location.