---
title: Web API Intro
description: "> A Web API is a developer’s dream. > > > > - It can extend the functionality of the browser > - It can greatly simplify complex functions > - It can provide easy syntax to complex code ##…"
url: "https://apprentice.mn/docs/web-api-intro/"
updated: "2021-05-19"
category: Javascript
---

# Web API Intro

> A Web API is a developer’s dream.
>
>
>
> - It can extend the functionality of the browser
> - It can greatly simplify complex functions
> - It can provide easy syntax to complex code

## What is Web API?

API stands for **A**pplication **P**rogramming **I**nterface.

A Web API is an application programming interface for the Web.

A Browser API can extend the functionality of a web browser.

A Server API can extend the functionality of a web server.

---

## Browser APIs

All browsers have a set of built-in Web APIs to support complex operations, and to help accessing data.

For example, the Geolocation API can return the coordinates of where the browser is located.

### Example

Get the latitude and longitude of the user’s position:

      `var x = document.getElementById("demo");

function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
  } else {
    x.innerHTML = "Geolocation is not supported by this browser.";
  }
}

function showPosition(position) {
  x.innerHTML = "Latitude: " + position.coords.latitude +
  "Longitude: " + position.coords.longitude;
}`

## Third Party APIs

Third party APIs are not built into your browser.

To use these APIs, you will have to download the code from the Web.

Examples:

- YouTube API – Allows you to display videos on a web site.
- Twitter API – Allows you to display Tweets on a web site.
- Facebook API – Allows you to display Facebook info on a web site.

        [https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fweb-api-intro%2F&linkname=Web%20API%20Intro](https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fweb-api-intro%2F&linkname=Web%20API%20Intro)[https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fweb-api-intro%2F&linkname=Web%20API%20Intro](https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fweb-api-intro%2F&linkname=Web%20API%20Intro)[https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fweb-api-intro%2F&linkname=Web%20API%20Intro](https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fapprentice.mn%2Fdocs%2Fweb-api-intro%2F&linkname=Web%20API%20Intro)[https://www.addtoany.com/share](https://www.addtoany.com/share)
