Created by Mariama Nyakateh Nyodeka
What is an API?
An API (Application Programming Interface) is a set of rules that lets two pieces of software talk to each other. It works like a messenger in the middle. You send a request to an API endpoint (a URL), it passes the request to the right service, and sends back a response. You do not need to know how the other side works internally. You only need to know how to send the right request and read the response.
There are three main parts involved:
- Client: your Python script. It creates and sends the request
- API endpoint + Server: ClickSend’s API layer and backend systems that process the request
- Destination endpoint: the recipient mobile network and phone that receives the message
A real-world example: ClickSend SMS
In this project, I used the ClickSend Python SDK instead of the requests library. The SDK handles the underlying HTTP request and response, so I can focus on the SMS data and workflow. The Python script acts as the client. It sends an SMS request to the ClickSend API. ClickSend receives the request, processes it, and sends the message to the destination phone number. After that, ClickSend returns a response so the script can show whether the message was accepted or if there was an error.
Here is what happens behind the scenes:
1. Your script collects the phone number and message text
2. It sends the details to the ClickSend API
3. ClickSend checks the request and queues the SMS
4. ClickSend returns a response with status details
Key concepts to know
- HTTP methods: the type of action you are making. GET is usually for reading data, POST is usually for sending data, PUT is for updating data, and DELETE is for removing data
- Endpoints: the specific API address you call, such as the ClickSend SMS endpoint
- JSON: the data format many APIs use to send and receive information
- API keys: a unique code used to identify and authorise your request
- Response: the data returned by the API after your request is processed
Why they matter
Almost every modern app uses APIs in some way. From logging in with Google to checking the weather and sending a text message, many everyday app features rely on APIs. They let you use powerful services without building everything from scratch.
Hope this helps you understand the basics of API.
Happy coding!