A REST API is a way for two programs to talk over the web. One program asks for data with a web address and a method, such as GET to read or POST to create. The other program replies with data, usually in JSON.
The parts of a request
- Endpoint: the address, such as /students/12.
- Method: GET reads, POST creates, PUT updates and DELETE removes.
- Response: a status code, such as 200 for success or 404 for not found, plus the data.
A small example in Python
Install the requests library, then call a public test API and print the status code and the JSON reply. Changing one value in the address and running it again shows how the same idea works for any API.
Once you can read a response, the next step is to build one. A Flask or Django app can return JSON from its own routes, which is the basis of a full stack project.
See the Python course, or read APIs and JSON for freshers. Book a free demo class, and ask a counsellor for batch details.
