Poll Data Services through APIs
Learn to poll any web API with Rust.
Web APIs
One of the staples of current web programming practices is a tendency to avoid monoliths in favor of small services, putting each one in charge of performing just one type of operation.
These servers have to communicate with each other through public APIs. Moreover, they typically use JSON to exchange data.
Therefore, to talk to any service, we need to know the following information:
- The API signature, which endpoint to poll, how to poll, what are they expecting in terms of body content, headers, HTTP methods, and so on.
- How to map the response to a custom struct so that we can access the data in our program.
- Server authorization and/or keys, especially if the servers have a cap on daily or monthly requests, or if their services involve a subscription of any kind.
The following sections are all examples of accessing web services with Rust.
Get hands-on with 1400+ tech skills courses.