Lesson 38. Consuming HTTP data
Having seen how to serve HTTP data by using ASP .NET in F#, you’re now going to look at the other side of the fence: consuming HTTP data quickly and easily by using various F# libraries. You’ll learn about
- How you might access HTTP endpoints today
- Using FSharp.Data to work with HTTP endpoints
- HTTP.fs, a lightweight F# library for HTTP access
- The Swagger type provider
Let’s start by quickly considering a few common situations you might encounter today.
You’ve written an ASP .NET Web API application and deploy it to an environment ready for testing. Quickly, the test team gives you feedback about some issues: some data doesn’t match as expected. And under certain circumstances, the APIs don’t seem to respond at all. You need to set up a way to easily explore these cases as they come, possibly even in a repeatable way.
Here’s another one. You need to consume an HTTP endpoint from an external supplier. The problem is that there’s no SDK to consume the API; you need to do it all yourself. The API is complex. You need to first authenticate with a time-limited token, before exploring the API (we don’t cover this in detail in this lesson, but an example is in the code samples for this lesson).