What is an API?
An API defines the rules under which software can access particular functions or information exposed by other software. It enables cooperation without knowing every internal detail. APIs are not limited to internet services: operating systems and programming libraries expose them too.
How do requests, responses and contracts work?
A weather application requests information for a location and displays the response. Web API requests include an address, method, headers and sometimes a body. Responses contain data and status information. JSON is a common data format, not another name for an API. The interface contract establishes required fields and error reporting. Version changes can affect clients. Delays, timeouts and service outages need handling even in ordinary operation.
Why are keys, authorization and rate limits used?
Authentication identifies a caller, while authorization determines permitted actions. An API key does not necessarily grant unrestricted access; its scope matters. Secret keys should not appear in public browser code. Rate limits reduce excessive resource use but do not stop every form of abuse. Inputs require validation and responses should avoid unnecessary personal information. Caching can improve speed but also requires managing stale responses. API use remains subject to the provider’s conditions and access rights.