Open In App

What is API? How it is useful in Web Development ?

Last Updated : 20 Sep, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

API stands for Application Programming Interface (main participant of all the interactivity)
It is like a messenger that takes our requests to a system and returns a response back to us via seamless connectivity.
We use APIs in many cases like to get data for a web application or to connect to a remote server that has data like weather that keeps changing or to enable two applications to exchange data among each other.
API not only provide reusability of code but also uses the concept of Abstraction (showing functionality by hiding complexity).
Most common real life use of API concepts include:

  • Waiter in a restaurant taking your order request to the chef and bringing back the requested dish
  • Switchboard turning off the tubelight just on a single press
  • Booking a flight online from sites like MMT(web based)
  • Signing up in a shopping site from Facebook Account(web based)

Different APIs will communicate in different ways:

  • XML-RCP/SOAP: Both uses XML
  • JavaScript: Focused around Javascript
  • RESTful APIs: HTTP protocol (HyperText Transfer Protocol) used (best for web APIs)

APIs’ major features in Web Development
APIs can be used for mashups that is information from one site can be mixed with that of another. Authentication is one of the important things to be noted as all APIs are not public. API keys are required in case of authentication for safe use. For example, please refer to Gmail API Authentication
There are some APIs which do not require any access token.

Example: Github API
https://api.github.com

Output:

{
  "current_user_url": "https://api.github.com/user",
  "current_user_authorizations_html_url": "https://github.com/settings/connections/applications{/client_id}",
  "authorizations_url": "https://api.github.com/authorizations",
  "code_search_url": "https://api.github.com/search/code?q={query}{&page, per_page, sort, order}",
  "commit_search_url": "https://api.github.com/search/commits?q={query}{&page, per_page, sort, order}",
  "emails_url": "https://api.github.com/user/emails",
  "emojis_url": "https://api.github.com/emojis",
  "events_url": "https://api.github.com/events",
  "feeds_url": "https://api.github.com/feeds",
  "followers_url": "https://api.github.com/user/followers",
  "following_url": "https://api.github.com/user/following{/target}",
  "gists_url": "https://api.github.com/gists{/gist_id}",
  "hub_url": "https://api.github.com/hub",
  "issue_search_url": "https://api.github.com/search/issues?q={query}{&page, per_page, sort, order}",
  "issues_url": "https://api.github.com/issues",
  "keys_url": "https://api.github.com/user/keys",
  "notifications_url": "https://api.github.com/notifications",
  "organization_repositories_url": "https://api.github.com/orgs/{org}/repos{?type, page, per_page, sort}",
  "organization_url": "https://api.github.com/orgs/{org}",
  "public_gists_url": "https://api.github.com/gists/public",
  "rate_limit_url": "https://api.github.com/rate_limit",
  "repository_url": "https://api.github.com/repos/{owner}/{repo}",
  "repository_search_url": "https://api.github.com/search/repositories?q={query}{&page, per_page, sort, order}",
  "current_user_repositories_url": "https://api.github.com/user/repos{?type, page, per_page, sort}",
  "starred_url": "https://api.github.com/user/starred{/owner}{/repo}",
  "starred_gists_url": "https://api.github.com/gists/starred",
  "team_url": "https://api.github.com/teams",
  "user_url": "https://api.github.com/users/{user}",
  "user_organizations_url": "https://api.github.com/user/orgs",
  "user_repositories_url": "https://api.github.com/users/{user}/repos{?type, page, per_page, sort}",
  "user_search_url": "https://api.github.com/search/users?q={query}{&page, per_page, sort, order}"
}

List in JSON format

  1. https://api.github.com/feeds
    Output:

    {
      "timeline_url": "https://github.com/timeline",
      "user_url": "https://github.com/{user}",
      "security_advisories_url": "https://github.com/security-advisories",
      "_links": {
        "timeline": {
          "href": "https://github.com/timeline",
          "type": "application/atom+xml"
        },
        "user": {
          "href": "https://github.com/{user}",
          "type": "application/atom+xml"
        },
        "security_advisories": {
          "href": "https://github.com/security-advisories",
          "type": "application/atom+xml"
        }
      }
    }
    
  2. https://api.github.com/rate_limit
    {
      "resources": {
        "core": {
          "limit": 60,
          "remaining": 56,
          "reset": 1567928119
        },
        "search": {
          "limit": 10,
          "remaining": 10,
          "reset": 1567924666
        },
        "graphql": {
          "limit": 0,
          "remaining": 0,
          "reset": 1567928206
        },
        "integration_manifest": {
          "limit": 5000,
          "remaining": 5000,
          "reset": 1567928206
        }
      },
      "rate": {
        "limit": 60,
        "remaining": 56,
        "reset": 1567928119
      }
    }
    

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads