API: Difference between revisions

From Computer Science Wiki
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[file:Studying.png|right|frame|Using an API<ref>http://www.flaticon.com/</ref>]]
[[file:Connection.png|right|frame|Web Science<ref>http://www.flaticon.com/</ref>]]


== Introduction ==
== Introduction ==
I am VERY GRATEFUL to Retriever Media Informatie B.V. who granted me permission to use their API material for my site.


In computer programming, an application programming interface (API) is a set of subroutine definitions, protocols, and tools for building application software. In general terms, it is a set of clearly defined methods of communication between various software components. <ref>https://en.wikipedia.org/wiki/Application_programming_interface</ref>
An API provides limited access to the functionality or data of an application or (online) service so it can be integrated into another application or service.  
<br />
[[File:Api.png|400px|]]
<br />
 
== How does it work? ==
I am VERY GRATEFUL to Retriever Media Informatie B.V. who granted me permission to use their API material for my site.  


An API provides limited access to the functionality or data of an application or (online) service so it can be integrated into another application or service. Google Maps’ API, for example, offers the possibility to integrate maps into your own website or app. The possibility to integrate the functionality of existing services ensures you don’t unnecessarily have to reinvent the wheel. You can expand your own offers and services by using APIs from other companies.
Google Maps’ API, for example, offers the possibility to integrate maps into your own website or app. The possibility to integrate the functionality of existing services ensures you don’t unnecessarily have to reinvent the wheel. You can expand your own offers and services by using APIs from other companies.


Technique
== Technique ==
In technical terms, an API contains a set of rules that manages and structures the communication between the various applications or websites. The API indicates what kind of data you can retrieve, how to do this and the format in which you will receive the data. When you do this according to the rules of the API, you will receive data or you can connect with functionalities which you will be able to use in your own application or websites. This way, the API is the link between your app that wants data and the supplier of the data. Data is mostly delivered in XML- or JSON-format.
In technical terms, an API contains a set of rules that manages and structures the communication between the various applications or websites. The API indicates what kind of data you can retrieve, how to do this and the format in which you will receive the data. When you do this according to the rules of the API, you will receive data or you can connect with functionalities which you will be able to use in your own application or websites. This way, the API is the link between your app that wants data and the supplier of the data. Data is mostly delivered in XML- or JSON-format.


Who provides APIs?
== Who provides APIs? ==
Many large companies provide an API. Facebook, Google (for, among others, Google Maps and YouTube), Dropbox and Buienradar are examples of companies that make their API available. When you are able to register for a service via Facebook, or share a website without having to leave the website, this is enabled by the Facebook API. Facebook benefits from this because their service is being used without them having to disclose their code.
Many large companies provide an API. Facebook, Google (for, among others, Google Maps and YouTube), Dropbox and Buienradar are examples of companies that make their API available. When you are able to register for a service via Facebook, or share a website without having to leave the website, this is enabled by the Facebook API. Facebook benefits from this because their service is being used without them having to disclose their code.


Line 24: Line 19:


== API keys ==  
== API keys ==  
=== What is an API key ===
An application programming interface key (API key) is a code passed in by computer programs calling an application programming interface (API) to identify the calling program, its developer, or its user to the Web site. API keys are used to track and control how the API is being used, for example to prevent malicious use or abuse of the API (as defined perhaps by terms of service).<ref>https://en.wikipedia.org/wiki/Application_programming_interface_key</ref>
An application programming interface key (API key) is a code passed in by computer programs calling an application programming interface (API) to identify the calling program, its developer, or its user to the Web site. API keys are used to track and control how the API is being used, for example to prevent malicious use or abuse of the API (as defined perhaps by terms of service).<ref>https://en.wikipedia.org/wiki/Application_programming_interface_key</ref>


The API key often acts as both a unique identifier & a secret token for authentication, and will generally have a set of access rights on the API associated with it.<ref>https://en.wikipedia.org/wiki/Application_programming_interface_key</ref>
The API key often acts as both a unique identifier & a secret token for authentication, and will generally have a set of access rights on the API associated with it.<ref>https://en.wikipedia.org/wiki/Application_programming_interface_key</ref>


 
== Example ==  
Please see below for a partial list of all the different API's you can interact with:
# https://deckofcardsapi.com/
<br />
# https://github.com/crobertsbmw/deckofcards
[[File:Example of APIs.png|400px]]
<br />
 
=== How do I get an API key? ===
 
You must register and apply for an API key for each API provider. For example, if you want to use a google API, you must register for an API key at google ([https://support.google.com/googleapi/answer/6158862?hl=en click here for help topic]). If you want to use an Apple API, you must register at Apple. Sometimes, companies will ask you to pay for an API key.
 
=== Is it always the same? ===
 
Once you have an API key, it generally does not change. However, companies are frequently updating their API, and sometimes companies can introduce '''breaking changes''' in which the API no longer works the way it had in the past. In these cases, companies can expire or cancel an API key.
 
== Examples ==
Thank you to google for releasing this code under CC30<ref>https://developers.google.com/maps/documentation/javascript/examples/map-simple</ref>
<syntaxhighlight lang="javascript">
<!DOCTYPE html>
<html>
  <head>
    <title>Simple Map</title>
    <meta name="viewport" content="initial-scale=1.0">
    <meta charset="utf-8">
    <style>
      /* Always set the map height explicitly to define the size of the div
      * element that contains the map. */
      #map {
        height: 100%;
      }
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>
      var map;
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 8
        });
      }
    </script>
    <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
    async defer></script>
  </body>
</html>
</syntaxhighlight>


== What is an API (video) ==
== What is an API (video) ==

Latest revision as of 15:15, 13 December 2021

Web Science[1]

Introduction[edit]

I am VERY GRATEFUL to Retriever Media Informatie B.V. who granted me permission to use their API material for my site.

An API provides limited access to the functionality or data of an application or (online) service so it can be integrated into another application or service. 

Google Maps’ API, for example, offers the possibility to integrate maps into your own website or app. The possibility to integrate the functionality of existing services ensures you don’t unnecessarily have to reinvent the wheel. You can expand your own offers and services by using APIs from other companies.

Technique[edit]

In technical terms, an API contains a set of rules that manages and structures the communication between the various applications or websites. The API indicates what kind of data you can retrieve, how to do this and the format in which you will receive the data. When you do this according to the rules of the API, you will receive data or you can connect with functionalities which you will be able to use in your own application or websites. This way, the API is the link between your app that wants data and the supplier of the data. Data is mostly delivered in XML- or JSON-format.

Who provides APIs?[edit]

Many large companies provide an API. Facebook, Google (for, among others, Google Maps and YouTube), Dropbox and Buienradar are examples of companies that make their API available. When you are able to register for a service via Facebook, or share a website without having to leave the website, this is enabled by the Facebook API. Facebook benefits from this because their service is being used without them having to disclose their code.

There are different forms of APIs: private APIs are only there for internal use. Partner APIs are only made available to companies by agreement. This ensures quality control to some extent. Public APIs are made available for use by the public. Everyone can use them.

The world is changing from analogue to digital and it is becoming increasingly important for companies to adapt to changes rapidly. APIs make it possible to exchange functionality and data in a structured and therefore stable way. As a result, companies can continue to focus on their key competences and combine these with services via APIs.[2]

API keys[edit]

An application programming interface key (API key) is a code passed in by computer programs calling an application programming interface (API) to identify the calling program, its developer, or its user to the Web site. API keys are used to track and control how the API is being used, for example to prevent malicious use or abuse of the API (as defined perhaps by terms of service).[3]

The API key often acts as both a unique identifier & a secret token for authentication, and will generally have a set of access rights on the API associated with it.[4]

Example[edit]

  1. https://deckofcardsapi.com/
  2. https://github.com/crobertsbmw/deckofcards

What is an API (video)[edit]

References[edit]