# Web API

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Web_API
> Markdown URL: https://mediated.wiki/source/Web_API.md
> Source: https://en.wikipedia.org/wiki/Web_API
> Source revision: 1326494105
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

HTTP-based application programming interface on the web

Screenshot of web API documentation written by NASA

A **web API** is an [application programming interface](/source/API) (API) for either a [web server](/source/Web_server) or a [web browser](/source/Web_browser). As a web development concept, it can be related to a web application's [client side](/source/Client_side) (including any [web frameworks](/source/Web_framework) being used). A server-side web API consists of one or more publicly exposed **endpoints** to a defined request–response message system, typically expressed in [JSON](/source/JSON) or [XML](/source/XML) by means of an [HTTP](/source/HTTP)-based web server.

A [server API](/source/Server_API) (SAPI) is not considered a server-side web API, unless it is publicly accessible by a remote web application.

## Client side

A [client-side](/source/Client-side) web API is a programmatic interface to extend functionality within a [web browser](/source/Web_browser) or other HTTP client. Originally these were most commonly in the form of native [plug-in](/source/Plug-in_(computing)) [browser extensions](/source/Browser_extension) however most newer ones target standardized [JavaScript](/source/JavaScript) bindings.

The [Mozilla Foundation](/source/Mozilla_Foundation) created their WebAPI specification which is designed to help replace native mobile applications with [HTML5](/source/HTML5) applications.[1][2]

[Google](/source/Google) created their [Native Client](/source/Google_Native_Client) architecture which is designed to help replace insecure native plug-ins with secure native [sandboxed](/source/Sandbox_(computer_security)) extensions and applications. They have also made this portable by employing a modified [LLVM](/source/LLVM) [AOT compiler](/source/Ahead-of-time_compilation).

## Server side

A [server-side](/source/Server-side) web API consists of one or more publicly exposed *endpoints* to a defined [request–response](/source/Request%E2%80%93response) message system, typically expressed in [JSON](/source/JSON) or [XML](/source/XML). The web API is exposed most commonly by means of an [HTTP](/source/Hypertext_Transfer_Protocol)-based [web server](/source/Web_server).

*[Mashups](/source/Mashup_(web_application_hybrid))* are [web applications](/source/Web_application) which combine the use of multiple server-side web APIs.[3][4][5] *[Webhooks](/source/Webhook)* are server-side web APIs that take input as a [Uniform Resource Identifier](/source/Uniform_Resource_Identifier) (URI) that is designed to be used like a remote [named pipe](/source/Named_pipe) or a type of [callback](/source/Callback_(computer_programming)) such that the server acts as a client to dereference the provided URI and trigger an event on another server which handles this event thus providing a type of peer-to-peer [IPC](/source/Inter-process_communication).

### Endpoints

Endpoints are important aspects of interacting with server-side web APIs, as they specify where resources can be accessed by third-party software. Usually the access is via a URI to which HTTP requests are posted, and from which the response is thus expected. Web APIs may be public or private, the latter of which requires an *[access token](/source/Access_token)*.[6]

Endpoints need to be static, otherwise the correct functioning of software that interacts with them cannot be guaranteed. If the location of a resource changes (and with it the endpoint) then previously written software will break, as the required resource can no longer be found at the same place. As API providers still want to update their web APIs, many have introduced a versioning system in the URI that points to an endpoint.

### Resources versus services

[Web 2.0](/source/Web_2.0) Web APIs often use machine-based interactions such as [REST](/source/REST) and [SOAP](/source/SOAP). RESTful web APIs use [HTTP](/source/HTTP) methods to access resources via URL-encoded parameters, and use [JSON](/source/JSON) or [XML](/source/XML) to transmit data. By contrast, [SOAP](/source/SOAP) protocols are standardized by the [W3C](/source/World_Wide_Web_Consortium) and mandate the use of [XML](/source/XML) as the payload format, typically over [HTTP](/source/HTTP). Furthermore, [SOAP](/source/SOAP)-based Web APIs use [XML validation](/source/XML_validation) to ensure structural message integrity, by leveraging the [XML schemas](/source/XML_schema) provisioned with [WSDL](/source/Web_Services_Description_Language) documents. A [WSDL](/source/Web_Services_Description_Language) document accurately defines the XML messages and transport bindings of a [Web service](/source/Web_service).

### Documentation

Server-side web APIs are interfaces for the outside world to interact with the business logic. For many companies this internal business logic and the intellectual property associated with it are what distinguishes them from other companies, and potentially what gives them a competitive edge. They do not want this information to be exposed. However, in order to provide a web API of high quality, there *needs* to be a sufficient level of documentation. One API provider that not only provides documentation, but also links to it in its error messages is [Twilio](/source/Twilio).[7]

However, there are now directories of popular documented server-side web APIs.[8]

### Growth and impact

The number of available web APIs has grown consistently over the past years, as businesses realize the growth opportunities associated with running an open platform, that any developer can interact with. [ProgrammableWeb](/source/ProgrammableWeb) tracks over 24000 Web APIs that were available in 2022, up from 105 in 2005.

Web APIs have become ubiquitous. There are few major software applications/services that do not offer some form of web API. One of the most common forms of interacting with these web APIs is via embedding external resources, such as tweets, Facebook comments, YouTube videos, etc. In fact there are very successful companies, such as [Disqus](/source/Disqus), whose main service is to provide embeddable tools, such as a feature-rich comment system.[9] Any website of the TOP 100 [Alexa Internet](/source/Alexa_Internet) ranked websites uses APIs and/or provides its own APIs, which is a very distinct indicator for the prodigious scale and impact of web APIs as a whole.[10]

As the number of available web APIs has grown, open source tools have been developed to provide more sophisticated search and discovery. APIs.json provides a machine-readable description of an API and its operations, and the related project APIs.io offers a searchable public listing of APIs based on the APIs.json metadata format.[11][12]

### Business

#### Commercial

Many companies and organizations rely heavily on their Web API infrastructure to serve their core business clients. In 2014 [Netflix](/source/Netflix) received around 5 billion API requests, most of them within their private API.[13]

#### Governmental

Many governments collect a lot of data, and some governments are now opening up access to this data. The interfaces through which this data is typically made accessible are web APIs. Web APIs allow for data, such as "budget, public works, crime, legal, and other agency data"[14] to be accessed by any developer in a convenient manner.

## Example

An example of a popular web API is the [Astronomy Picture of the Day](/source/Astronomy_Picture_of_the_Day) API operated by the American space agency [NASA](/source/NASA). It is a server-side API used to retrieve photographs of space or other images of interest to [astronomers](/source/Astronomer), and [metadata](/source/Metadata) about the images.

According to the API documentation,[15] the API has one endpoint:

[https://api.nasa.gov/planetary/apod](https://api.nasa.gov/planetary/apod)[*[permanent dead link](https://en.wikipedia.org/wiki/Wikipedia:Link_rot)*]

The documentation states that this endpoint accepts [GET requests](/source/GET_request). It requires one piece of information from the user, an [API key](/source/API_key), and accepts several other optional pieces of information. Such pieces of information are known as *parameters*. The parameters for this API are written in a format known as a [query string](/source/Query_string), which is separated by a [question mark](/source/Question_mark) character (?) from the endpoint. An [ampersand](/source/Ampersand) (&) separates the parameters in the query string from each other. Together, the endpoint and the query string form a [URL](/source/URL) that determines how the API will respond. This URL is also known as a *query* or an *API call*.

In the below example, two parameters are transmitted (or *passed*) to the API via the query string. The first is the required API key and the second is an optional parameter — the date of the photograph requested.

[https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&date=1996-12-03](https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&date=1996-12-03)

Visiting the above URL in a web browser will initiate a GET request, calling the API and showing the user a result, known as a *[return value](/source/Return_value)* or as a *return*. This API returns [JSON](/source/JSON), a type of data format intended to be understood by computers, but which is somewhat easy for a human to read as well. In this case, the JSON contains information about a photograph of a [white dwarf star](/source/White_dwarf_star):

{
  "date":"1996-12-03",
  "explanation":"Like a butterfly,\r a white dwarf star begins its life\r by casting off a cocoon that enclosed its former self. In this\r analogy, however, the Sun would be\r a caterpillar\r and the ejected shell of gas would become the prettiest of all!\r The above cocoon, the planetary nebula\r designated NGC 2440, contains one of the hottest white dwarf stars known.\r The white dwarf can be seen as the bright dot near the photo's\r center. Our Sun will eventually become a \"white dwarf butterfly\",\r but not for another 5 billion years. The above false color image recently entered the public domain\r and was post-processed by F. Hamilton.\r",
  "hdurl":"https://apod.nasa.gov/apod/image/9612/ngc2440_hst2_big.jpg",
  "media_type":"image",
  "service_version":"v1",
  "title":"Cocoon of a New White Dwarf\r\nCredit:",
  "url":"https://apod.nasa.gov/apod/image/9612/ngc2440_hst2.jpg"
}

The above API return has been reformatted so that names of JSON data items, known as *keys*, appear at the start of each line. The last of these keys, named url, indicates a URL which points to a photograph:

[https://apod.nasa.gov/apod/image/9612/ngc2440_hst2.jpg](https://apod.nasa.gov/apod/image/9612/ngc2440_hst2.jpg)

Following the above URL, a web browser user would see this photo:

Although this API can be called by an [end user](/source/End_user) with a web browser (as in this example) it is intended to be called automatically by software or by computer programmers while writing software. JSON is intended to be [parsed](/source/Parsing) by a computer program, which would extract the URL of the photograph and the other metadata. The resulting photo could be embedded in a website, automatically sent via text message, or used for any other purpose envisioned by a software developer.

## See also

- [Dynamic web page](/source/Dynamic_web_page)

- [Overview of RESTful API Description Languages](/source/Overview_of_RESTful_API_Description_Languages)

- [REST](/source/REST)

- [GraphQL](/source/GraphQL)

- [Web service](/source/Web_service)

## References

1. **[^](#cite_ref-1)** ["Mozilla's WebAPI Wants to Replace Native Apps With HTML5 | Webmonkey | Wired.com"](https://web.archive.org/web/20131205024538/http://www.webmonkey.com/2011/08/mozillas-webapi-wants-to-replace-native-apps-with-html5/). *en-US*. 2013-12-05. Archived from [the original](http://www.webmonkey.com/2011/08/mozillas-webapi-wants-to-replace-native-apps-with-html5/) on 2013-12-05. Retrieved 2022-01-13.

1. **[^](#cite_ref-2)** [Mozilla WebAPI Wiki](https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Client-side_APIs)

1. **[^](#cite_ref-3)** ["What is mash-up? - Definition from WhatIs.com"](http://whatis.techtarget.com/definition/mash-up). *WhatIs.com*. [Archived](https://web.archive.org/web/20150424163155/http://whatis.techtarget.com/definition/mash-up) from the original on Apr 24, 2015. Retrieved 2015-11-04.

1. **[^](#cite_ref-4)** ["Mashup Dashboard"](https://web.archive.org/web/20210507015502/http://www.programmableweb.com/mashups). ProgrammableWeb.com. 2009. Archived from [the original](http://www.programmableweb.com/mashups) on May 7, 2021. Retrieved May 29, 2021.

1. **[^](#cite_ref-5)** Maximilien, E. Michael; Ranabahu, Ajith; Gomadam, Karthik (Sep–Oct 2008). "An Online Platform for Web APIs and Service Mashups". *[IEEE Internet Computing](/source/IEEE_Internet_Computing)*. **12** (5): 32–43. [doi](/source/Doi_(identifier)):[10.1109/MIC.2008.92](https://doi.org/10.1109%2FMIC.2008.92). [S2CID](/source/S2CID_(identifier)) [14949046](https://api.semanticscholar.org/CorpusID:14949046).

1. **[^](#cite_ref-6)** ["Changes coming in Version 1.1 of the Twitter API"](https://blog.twitter.com/developer/en_us/a/2012/changes-coming-to-twitter-api.html). *en-US*. 16 August 2012. Retrieved 1 August 2019.{{[cite web](https://en.wikipedia.org/wiki/Template:Cite_web)}}: CS1 maint: url-status ([link](https://en.wikipedia.org/wiki/Category:CS1_maint:_url-status))

1. **[^](#cite_ref-7)** Mulloy, Brian. [*Web API Design - Crafting Interfaces that Developers Love*](https://pages.apigee.com/rs/apigee/images/api-design-ebook-2012-03.pdf) (PDF). apigee. p. 11.

1. **[^](#cite_ref-8)** ["Public APIs"](https://github.com/public-apis/public-apis). *GitHub*. Retrieved 2025-11-14.

1. **[^](#cite_ref-9)** ["Disqus – The Web's Community of Communities"](https://disqus.com/). *Disqus*. Retrieved 2015-11-04.

1. **[^](#cite_ref-10)** ["Alexa Top 500 Global Sites"](https://web.archive.org/web/20150302173920/http://www.alexa.com/topsites). *www.alexa.com*. Archived from [the original](http://www.alexa.com/topsites) on 2015-03-02. Retrieved 2015-11-04.

1. **[^](#cite_ref-11)** ["APIs.json"](http://apisjson.org/). *apisjson.org*. Retrieved 2016-03-14.

1. **[^](#cite_ref-12)** ["APIs.io - the API search engine"](http://apis.io/). *apis.io*. Retrieved 2016-03-14.So make it clearly understandable & share your knowledge.

1. **[^](#cite_ref-13)** ["Top 10 Lessons Learned from the Netflix API - OSCON 2014, Slide 73"](https://www.slideshare.net/danieljacobson/top-10-lessons-learned-from-the-netflix-api-oscon-2014). 2014-07-24. {{[cite journal](https://en.wikipedia.org/wiki/Template:Cite_journal)}}: Cite journal requires |journal= ([help](https://en.wikipedia.org/wiki/Help:CS1_errors#missing_periodical))

1. **[^](#cite_ref-14)** ["Tech Trends 2015, API economy"](https://web.archive.org/web/20160815023024/http://dupress.com/articles/tech-trends-2015-what-is-api-economy/). *Deloitte University Press*. Archived from [the original](http://dupress.com/articles/tech-trends-2015-what-is-api-economy/) on 2016-08-15. Retrieved 2015-11-03.

1. **[^](#cite_ref-15)** ["Astronomy Picture of the Day"](https://api.nasa.gov/). *NASA APIs*.

## Further reading

- Jacobson, Daniel; Woods, Dan; Brail, Greg (November 2011). *APIs a strategy guide*. Sebastopol, Calif: [O'Reilly Media](/source/O'Reilly_Media). [ISBN](/source/ISBN_(identifier)) [978-1-4493-0892-6](https://en.wikipedia.org/wiki/Special:BookSources/978-1-4493-0892-6).

- Mulloy, Brian. [*Web API Design - Crafting Interfaces that Developers Love*](https://pages.apigee.com/rs/351-WXY-166/images/Web-design-the-missing-link-ebook-2016-11.pdf) (PDF). Apigee.

- ["Web APIs"](https://web.archive.org/web/20180719084229/https://developer.chrome.com/extensions/api_other). *Google Chrome*. Archived from [the original](https://developer.chrome.com/extensions/api_other) on 2018-07-19. Retrieved 2015-11-30.

- ["Web API reference - Web technology reference"](https://developer.mozilla.org/en-US/docs/Web/Reference/API). *[Mozilla Developer Network](/source/Mozilla_Developer_Network)*. 20 February 2023.

- ["Web API Demonstration"](http://sourcecodehub.com/article/428/api-demonstration-aspnet). *Web API Demonstration*.

v t e Web interfaces Server-side Protocols HTTP v2 v3 Encryption WebDAV CGI SCGI FCGI AJP WSRP WebSocket Server APIs C NSAPI C ASAPI C ISAPI COM ASP Jakarta Servlet container CLI OWIN ASP.NET Handler Python WSGI Python ASGI Ruby Rack JavaScript JSGI Perl PSGI Portlet container Apache modules mod_include mod_jk mod_lisp mod_mono mod_parrot mod_perl mod_php mod_proxy mod_python mod_wsgi mod_ruby Phusion Passenger Topics Web service vs. Web resource WOA vs. ROA Open API Webhook Application server comparison Scripting Client-side Browser APIs C NPAPI LiveConnect XPConnect C NPRuntime C PPAPI NaCl ActiveX BHO XBAP Web APIs WHATWG Audio Canvas DOM SSE Video WebSockets Web messaging Web storage Web worker XMLHttpRequest W3C DOM events EME File Geolocation IndexedDB MSE SVG WebAssembly WebAuthn WebGPU WebRTC WebXR Khronos WebCL WebGL Others Gears Web SQL Database (formerly W3C) WebUSB Topics Ajax and Remote scripting vs. DHTML Browser extension Cross-site scripting and CORS Hydration Mashup Persistent data Web IDL Scripting Related topics Frontend and backend Microservices REST GraphQL Push technology Solution stack Web page Static Dynamic Web standards Web API security Web application Rich Single-page Progressive Web framework

v t e Cloud computing Business models Content as a service Data as a service Desktop as a service Function as a service Infrastructure as a service Integration platform as a service Backend as a service Network as a service Platform as a service Security as a service Software as a service Technologies Cloud database Cloud-native computing Cloud storage Cloud storage gateways Data centers Dew computing Distributed file system for cloud Hardware virtualization Internet Mobile cloud computing Native cloud application Networking Personal cloud Security Serverless computing Structured storage Virtual appliance Web APIs Virtual private cloud Applications Box Dropbox Google Workspace Drive HP Cloud (closed) IBM Cloud Lark Microsoft Office 365 OneDrive Nextcloud OpenDesk Oracle Cloud Owncloud Proton Drive Rackspace Salesforce Seafile PlateSpin Workday Zoho Platforms Alibaba Cloud Amazon Web Services AppScale Box CloudBolt Cloud Foundry Cocaine (PaaS) Engine Yard Helion GE Predix Google App Engine GreenQloud Heroku IBM Cloud Inktank Jelastic Microsoft Azure MindSphere Netlify Oracle Cloud OutSystems openQRM OpenShift PythonAnywhere RightScale Scalr Force.com SAP Business Technology Platform Splunk Vercel vCloud Air WaveMaker Infrastructure Alibaba Cloud Amazon Web Services Abiquo Enterprise Edition CloudStack Citrix Cloud Deft DigitalOcean EMC Atmos Eucalyptus Fujitsu Google Cloud GreenButton GreenQloud IBM Cloud iland Joyent Linode Lunacloud Microsoft Azure Mirantis Netlify Nimbula Nimbus OpenIO OpenNebula OpenStack Oracle Cloud OrionVM Rackspace Cloud Safe Swiss Cloud Zadara libvirt libguestfs OVirt Virtual Machine Manager Wakame-vdc Vercel Virtual Private Cloud OnDemand Category Commons

---
Adapted from the Wikipedia article [Web API](https://en.wikipedia.org/wiki/Web_API) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Web_API?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
