What is an API ?

API stands for Application Programming Interface, it is a set of commands, functions, protocols and objects that developers can use to integrate application, software or interact with external system.

Terms that you’ll hear while working with APIs: Endpoint, Path, Parameters and Authentication.

Endpoint: API that interacts with external system will have an endpoint. Endpoint is typically a URL of a server or service that provides the location of a resource.

Path: After endpoint, path can be added.

Parameters: Parameters go at the end of the URL, after a question mark and a key value pair.

We use Path & Parameters to narrow down on the exact type of data that we want.

Authentication: It is not similar to Authorization. Authorization tell what you can do and Authentication tell Who you are. Authentication process validates the identity of the client attempting to make a connection by using an authentication protocol.

Common authentication methods: Basic Authentication, Bearer Authentication, API access tokens & OAuth.

Different Methods / operation types in API:

GET: Retrieves data from the server.
PUT: Updates data that is stored in the server.
POST: Sends data to the server for processing.
DELETE: Removes data from the server.

What is JSON ?

JSON stands for JavaScript Object Notation, it is a text-based data exchange format, a collection of key-value pairs where the key must be a string type, and the value can be of any of the types: Number, String, Boolean, Array, Object, null.

  • In the JSON data format, the keys must be enclosed in double quotes.
  • The key and value must be separated by a colon (:) symbol.
  • There can be multiple key-value pairs. Two key-value pairs must be separated by a comma (,) symbol.

JSON can be in two different formats:

JSON Objects: written inside curly braces.

{
	"id": 9861,
	"name": "Siva Prasad",
	"email": "siva9861@golmaal.com"
}

JSON Arrays: written inside square brackets.

[
    {
        "id": 9861,
        "name": "Siva Prasad",
        "email": "siva9861@golmaal.com"
    },
    {
        "id": 9862,
        "name": "nikki",
        "email": "nikki9862@golmaal.com"
    }
]

One of the handy website to validate Json is https://jsonlint.com/.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s