Help with HttpClient GET

Hi All,

I’ve spent the past two days looking into how I can use a photon to get the information on launchlibrary.net into a usable form so that I can control an LED array. It seems like HttpClient is my best option but I’m having trouble getting it going. I also read up on webhooks but not sure if those would work given the fact that the information I’m getting is constantly changing I may be misunderstanding how others explained them on the forum here).

Essentially, I am trying to look for any launches in the next 24 hours and get the location and exact time of launch. Maybe there’s a better way of doing this that I haven’t found but any help in learning how to do this is appreciated. Thank you in advance.

I poked at their site using curl the command line tool for making HTTP requests. It worked ok for me on HTTP (not HTTPS which can be hard on a Photon). The API doc on their site says you can have problems if you are not passing reasonable Accept and User-Agent fields for curl used. The Host: field is also super important since launchlibrary.net runs on Amazon AWS and there is not a 1-to-1 mapping of hosts/webservers to sites. In other words launchlibrary.net resolves to 52.87.73.117 but so could several other websites hosted there and the Host: field is how the web server “knows” who you want to talk to.

Host: launchlibrary.net
User-Agent: curl/7.54.0
Accept: */*

So I would make sure your httpclient is passing those or similar.

Thanks for the response Brian. Am admittedly a little over my head with this part of the project so excuse my potentially naive questions.

Would it be possible to use curl to program a photon so that it is fully automated and gets the information separate from the computer/command prompt? Do you know of any well written tutorials that could help me fully understand how to do this through any of these methods (curl, HttpClient, webhooks, etc)? Feel like I’m grasping in the dark here, haven’t found many resources and don’t want to keep pestering people with basic questions.