top of page
Search

APIs

Updated: May 6, 2020

Application Program Interface (API) permits the interaction between two systems.



Parameters start after the question ? mark and each are separated by ampersand &


Example of API Payload in JSON format:


{ "formatVersion": 2, "category": "Miscellaneous", "type": "single", "joke": "A horse walks into a bar...", "flags": { "nsfw": true, "religious": false, "political": true, "racist": false, "sexist": false } }

An API endpoint is basically a fancy word for a URL of a server or service.


APIs operate through ‘requests’ and ‘responses.’ And when an API requests to access data from a web application or server, a response is always sent back. The location where the API sends a request and where the response emanates is what is known as an endpoint.  Reputedly, the endpoint is the most crucial part of the API documentation since it’s what the developer will implement to make their requests.


An API refers to a set of protocols and tools that allow interaction between two different applications. In simple terms, it is a technique that enables third-party vendors to write programs that can easily interface with each other. On the other hand, an endpoint is the place of interaction between applications. API refers to the whole set of protocols that allows communication between two systems while an endpoint is a URL that enables the API to gain access to resources on a server.


use of APIs to aid in the transfer of critical data, transactions, and processes.


Endpoints help to depict the exact location of the resources to be accessed by API.


JSON - Javascript Object Notation


Pretty

{
 "coord": {
 "lon": -0.13,
 "lat": 51.51
    },
 "weather": [
        {
 "id": 801,
 "main": "Clouds",
 "description": "few clouds",
 "icon": "02d"
        }
    ],
 "base": "stations",
 "main": {
 "temp": 17.33,
 "feels_like": 11.87,
 "temp_min": 15.56,
 "temp_max": 20,
 "pressure": 1020,
 "humidity": 55
    },
 "visibility": 10000,
 "wind": {
 "speed": 7.2,
 "deg": 90
    },
 "clouds": {
 "all": 20
    },
 "dt": 1588603542,
 "sys": {
 "type": 1,
 "id": 1414,
 "country": "GB",
 "sunrise": 1588566366,
 "sunset": 1588620501
    },
 "timezone": 3600,
 "id": 2643743,
 "name": "London",
 "cod": 200
}

Raw

{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}],"base":"stations","main":{"temp":17.33,"feels_like":11.87,"temp_min":15.56,"temp_max":20,"pressure":1020,"humidity":55},"visibility":10000,"wind":{"speed":7.2,"deg":90},"clouds":{"all":20},"dt":1588603542,"sys":{"type":1,"id":1414,"country":"GB","sunrise":1588566366,"sunset":1588620501},"timezone":3600,"id":2643743,"name":"London","cod":200}

Another option to JSON is XML - extensible markup language.


Big picture of using an API


Client -> Your Server -> API -> Third Party Server


Client makes GET request to our server.


Our server makes GET Request to 3rd party server to fetch data and Receives Response back as a JSON via API.


Requests made with Parameters, Path, key value pairs.


Response from API with data.


Send data from our server with a response to client.


Ctrl+K+C, you'll comment out the section of code. Ctrl+K+U will uncomment the code

Recent Posts

See All

Generative AI report

Top GenAI companies: OpenAI Google Anthropic Meta Mistral Stability AI MidJourney Top GenAI Models GPT 4 Gemini 1.5 Llama2 Mistral Claude Stable Diffusion

bottom of page