API Client
noun
say it: “AY-PEE-EYE KLY-ent” /ˌeɪ piː ˈaɪ ˈklaɪənt/
A class that wraps a web API's endpoints in ordinary methods, so other code never handles URLs or JSON.
What is API Client?
API Client — A class that wraps a web API's endpoints in ordinary methods, such as GetProductsAsync(). The rest of the program calls methods and gets objects back, and never sees the URLs, status codes or JSON.
class ProductsApi(HttpClient client)
{
public Task<List<Product>?> GetAllAsync() =>
client.GetFromJsonAsync<List<Product>>("api/products");
}
In a sentence
- “The ProductsApi API client gives the rest of the app plain methods like GetAllAsync().”
Level: Journeyman · More REST API terms at this level
Updated