Editing 1481: API

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 10: Line 10:
 
This comic presents a web site designed for human readers as if it had an API ({{w|application programming interface}}) designed for machine-to-machine {{w|web service}}. An API is a set of instructions about a computer program, intended to be used by developers of other computer programs, so the two programs can interoperate more easily. The documentation explains how to send commands to the program, and how the output will be returned.
 
This comic presents a web site designed for human readers as if it had an API ({{w|application programming interface}}) designed for machine-to-machine {{w|web service}}. An API is a set of instructions about a computer program, intended to be used by developers of other computer programs, so the two programs can interoperate more easily. The documentation explains how to send commands to the program, and how the output will be returned.
  
Many web APIs are designed to return data in {{w|XML}} format. But in this case, the XML is {{w|XHTML}}, a version of the language that is used by most web pages. The "requested data" is the actual content (e.g., a blog post), and "documentation" refers (in an obscure way) to the parts of a web page that control how it looks on the screen (e.g. {{w|Cascading_Style_Sheets|CSS}} and perhaps JavaScript layout code). The
+
Many web APIs are designed to return data in {{w|XML}} format. But in this case, the XML is {{w|XHTML}}, a version of the language that is used by most web pages. The "requested data" is the actual content (e.g. a blog post), and "documentation" refers (in an obscure way) to the parts of a web page that control how it looks on the screen (e.g. {{w|Cascading_Style_Sheets|CSS}} and perhaps JavaScript layout code). The
 
"documentation" may also be {{w|DTD}} which tells the XML parser info about this particular {{w|XML}} format, i.e. XHTML.  
 
"documentation" may also be {{w|DTD}} which tells the XML parser info about this particular {{w|XML}} format, i.e. XHTML.  
  
 
In order for a program to process a generic web site designed for human viewing, the program needs to use {{w|web scraping}} techniques, which often break when the web site design changes in subtle ways that a human might never notice. Therefore, developers [http://www.rubyinside.com/ruby-gets-a-stylish-html-scraper-scrapi-140.html prefer to have proper APIs] with well-defined machine-readable formats, stable interfaces and documentation that actually describes the semantics of the data.
 
In order for a program to process a generic web site designed for human viewing, the program needs to use {{w|web scraping}} techniques, which often break when the web site design changes in subtle ways that a human might never notice. Therefore, developers [http://www.rubyinside.com/ruby-gets-a-stylish-html-scraper-scrapi-140.html prefer to have proper APIs] with well-defined machine-readable formats, stable interfaces and documentation that actually describes the semantics of the data.
  
For example, Google has an [https://developers.google.com/youtube/v3/getting-started official API for version 3 of their YouTube web service]. But developers who don't want to hassle with the required API key or the costs associated with its use sometimes just [https://stackoverflow.com/questions/20407107/scraping-youtube-mix-playlist-id-for-a-video scrape the regular YouTube web site]. So, someone could publish this comic with a YouTube URL as a convoluted hint to developers that there is an alternative to the official API.
+
For example, Google has an [https://developers.google.com/youtube/v3/getting-started official API for version 3 of their Youtube web service]. But developers who don't want to hassle with the required API key or the costs associated with its use sometimes just [http://stackoverflow.com/questions/20407107/scraping-youtube-mix-playlist-id-for-a-video scrape the regular YouTube web site]. So someone could publish this comic with a YouTube URL as a convoluted hint to developers that there is an alternative to the official API.
  
 
The API keys section is a step-by-step description of how a web page is protected with {{w|HTTP Secure}} (HTTPS). The {{w|Transport Layer Security}} (TLS) protocol uses an {{w|elliptic curve Diffie–Hellman}} (ECDH) key signed using {{w|Rivest-Shamir-Adleman}} (RSA) encryption, which is stored in an {{w|X.509}} certificate. Normally, the browser or operating system does this behind the scenes, so most web developers and users do not need to know these details.
 
The API keys section is a step-by-step description of how a web page is protected with {{w|HTTP Secure}} (HTTPS). The {{w|Transport Layer Security}} (TLS) protocol uses an {{w|elliptic curve Diffie–Hellman}} (ECDH) key signed using {{w|Rivest-Shamir-Adleman}} (RSA) encryption, which is stored in an {{w|X.509}} certificate. Normally, the browser or operating system does this behind the scenes, so most web developers and users do not need to know these details.
  
The access limits mentioned in the title text says that the API can be used for 86,400 seconds each day. At first this may appear to be a strange arbitrary number; however, it is in fact the total number of seconds in 24 hours, essentially meaning there is no limit on most days. The {{w|International Earth Rotation and Reference Systems Service}} (IERS) is the organization that decides when to add {{w|leap seconds}}, which account for slight anomalies in the Earth's rotation as compared to the {{w|mean solar day}}. These leap seconds will mean that the website is available for one extra second occasionally, although IERS decisions are based on actual Earth rotation rates, and they of course wouldn't respond to requests for leap seconds in order to lengthen the number of seconds that a web site would be available for in a given calendar day.  The API does not discuss the issue that some days have 23 or 25 hours due to {{w|Daylight saving time|daylight saving time}} in the U.S. and {{w|Summer time|summer time}} in Europe and some other places. This suggests that the web service tracks time via {{w|UTC}}.
+
The access limits mentioned in the title text says that the API can be used for 86,400 seconds each day. At first this may appear to be a strange arbitrary number, however it is in fact the total number of seconds in 24 hours, essentially meaning there is no limit on most days. The {{w|International Earth Rotation and Reference Systems Service}} (IERS) is the organization that decides when to add {{w|leap seconds}}, which account for slight anomalies in the Earth's rotation as compared to the {{w|mean solar day}}. These leap seconds will mean that the website is available for one extra second occasionally, although IERS decisions are based on actual Earth rotation rates and they of course wouldn't respond to requests for leap seconds in order to lengthen the number of seconds that a web site would be available for in a given calendar day.  The API does not discuss the issue that some days have 23 or 25 hours due to {{w|Daylight saving time|daylight saving time}} in the U.S. and {{w|Summer time|summer time}} in Europe and some other places. This suggests that the web service tracks time via {{w|UTC}}.
  
 
==Transcript==
 
==Transcript==

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)