You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 18, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: api-basics.md
+18-16Lines changed: 18 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,9 @@
1
1
---
2
+
published: true
2
3
layout: default
3
4
title: API basics
4
-
permalink: /api-basics/
5
-
filename: api-basics.md
5
+
permalink: "/api-basics/"
6
+
filename: "api-basics.md"
6
7
---
7
8
8
9
### What is an API?
@@ -15,11 +16,11 @@ APIs are launched primarily to give partners that are outside the agency or comp
15
16
16
17
### Why do you need an API?
17
18
18
-
We want to make government more efficient; essentially do more with less. Government data assets are numerous and valuable, and we cannot afford to waste time and money by duplicating data processes. APIs allow for machine to machine querying, essentially removing the barriers to access data. APIs are not useful in all cases, but by providing data as a service, the opportunity for significantly reducing the barrier to access data and proliferate an innovation economy exists. Without them, we institute a culture of replicating data processes every time we use them.
19
+
We want to make government more efficient; essentially do more with less. Government data assets are numerous and valuable, and we cannot afford to waste time and money by duplicating data processes. APIs allow for machine to machine querying, essentially removing the barriers to access data. APIs are not useful in all cases, but by providing data as a service, the opportunity for significantly reducing the barrier to access data and proliferate an innovation economy exists. Without them, we institute a culture of replicating data processes every time we use them.
19
20
20
21
### History of modern web APIs
21
22
22
-
APIs have been around since the 1980s, when they were used in hardware and software development. However, the history of the modern Web API is fairly short -- just a little over ten years. There are several pioneers of Web APIs, and while they didn't necessarily invent any of the technologies at play here, they did popularize their usage and establish some of the common practices.
23
+
APIs have been around since the 1980s, when they were used in hardware and software development. However, the history of the modern Web API is fairly short -- just a little over ten years. There are several pioneers of Web APIs, and while they didn't necessarily invent any of the technologies at play here, they did popularize their usage and establish some of the common practices.
23
24
24
25
### How government agencies are using APIs
25
26
@@ -58,45 +59,46 @@ Many of these pioneers have shaped the way in which we develop, deploy, consume,
58
59
59
60
### What technology goes into an API?
60
61
61
-
APIs are driven by a set of specific technologies, making them easily understood by developers. This type of standardization means that APIs can work with common programming languages. The most popular approach to delivering web APIs, which is:
62
+
APIs are driven by a set of specific technologies, making them easily understood by developers. This type of standardization means that APIs can work with common programming languages. The most popular approach to delivering web APIs is:
Since REST takes advantage of the same Internet mechanisms that are used to view regular web pages it has many advantages, resulting in faster implementations and easier for developers to understand. REST APIs allow you to take data and functionality available on your website and make these resources available through a Web API. Then, instead of returning HTML to represent these resources, the API returns data in one of two possible formats:
66
+
Since REST takes advantage of the same Internet mechanisms that are used to view regular web pages it has many advantages, resulting in faster implementations and and ease of use for developers. REST APIs allow you to take data and functionality available on your website and make these resources available through a Web API. Then, instead of returning HTML to represent these resources, the API returns data in one of two possible formats:
66
67
67
68
<ul>
68
69
<li><ahref="http://apievangelist.com/buildingblocks/extensible_markup_language_(xml).php">Extensible Markup Language (XML)</a></li>
Developers can then take this data and use in web and mobile applications. However XML and JSON are easily consumed by spreadsheets and other tools non-developers can use as well, making APIs accessible by anyone.
73
+
Developers can then take this data and use it in web and mobile applications. In addition, XML and JSON are easily consumed by spreadsheets and other tools non-developers can use as well, making APIs accessible by anyone.
73
74
74
75
75
-
REST with JSON has become the favorite of developers and API owners, because it is easier to both deploy and consume than other implementations. Even though REST + JSON is not a standard, it is seeing wide acceptance across the industry.
76
+
REST with JSON has become the favorite of developers and API owners because it is easier to both deploy and consume than other implementations. Even though REST + JSON is not a standard, it is seeing wide acceptance across the industry.
76
77
77
78
### When Things Go Wrong — Error Handling
78
79
79
-
One of the most important issues to remember in API strategy is, developers need to handle what happens when an error occurs; otherwise, access to data fails and subsequently so does the application. For the purposes of the service framework, an error is defined as an unexpected behavior that occurred during the process of a request. It's important to note that what might be considered an "error" can often be an expected behavior.
80
+
One of the most important issues to remember in API strategy is that developers need to handle what happens when an error occurs otherwise access to data fails and subsequently so does the application. For the purposes of the service framework, an error is defined as an unexpected behavior that occurred during the process of a request. It's important to note that what might be considered an "error" can often be an expected behavior.
81
+
80
82
For instance, a search operation returning no results (a blank object) and an HTTP status 200 OK code might be construed as an error, but in reality this is not outside the realm of expected normal operation.
81
83
82
-
So really when we say errors we mean bad things happen like a database server goes down or a required parameter wasn't passed to a URI. Ultimately it is the responsibility of your code to anticipate and appropriately handle errors.
84
+
So really when we say errors we mean bad things happen (a database server goes down or a required parameter wasn't passed to a URI). Ultimately it is the responsibility of your code to anticipate and appropriately handle errors.
83
85
84
86
### Developing an API Ecosystem
85
87
86
-
An API starts with the desire to share data or resources that a company offers. It's built with technologies like REST, XML, and JSON, and supported through documentation, along with a handful of code samples to show how to use it.
88
+
An API starts with the desire to share data or resources that a company offers. It's built with technologies like REST, XML, and JSON, and supported through documentation, along with a handful of code samples to show how to use it.
87
89
88
-
An API and its supporting developer area are created. And then, what's next? How does a simple API area build community? How does it evolve into a thriving ecosystem like Facebook’s of Foursquare's?
90
+
An API and its supporting developer area are created. And then, what's next? How does a simple API area build community? How does it evolve into a thriving ecosystem like Facebook’s of Foursquare's?
89
91
90
-
It all starts with developers. Giving developers a self-service, resource-rich environment where they have the spotlight and a voice that will encourage them in turn to contribute to the API community.
92
+
It all starts with developers. Giving developers a self-service, resource-rich environment where they have the spotlight and a voice that will encourage them in turn to contribute to the API community.
91
93
92
94
An API owner has to support its API's community, be proactive about reaching out to its community and know what it needs.
93
95
94
-
Resources for developers need to be abundant and well organized. Common resources like blogs, forum, and FAQs are necessary. Tutorials, case studies and "How To’s" can take things even further.
96
+
Resources for developers need to be abundant and well organized. Common resources such as blogs, forum, and FAQs are necessary. Tutorials, case studies and "How To’s" can take things even further.
95
97
96
98
Support and resources can create a positive feedback loop among developers and encourage activity that will ideally spread to other users.
97
99
98
100
Developers can’t be expected to visit an API area regularly, so an API community needs to extend its reach to existing social network and developer communities including Twitter, LinkedIn, Github, and Stack Exchange.
99
101
100
-
Even more than just a presence on these social networks, an API needs to have an offline presence too -- something that can be accomplished by attending conferences, meet-ups, and hackathons, for example. These activities will only serve to strengthen the API community.
102
+
Even more than just a presence on these social networks, an API needs to have an offline presence too -- something that can be accomplished by attending conferences, meet-ups, and hackathons, for example. These activities will only serve to strengthen the API community.
101
103
102
-
*Re-used from [apievangilist.com](http://www.apievangelist.com) under a [Creative Commons](http://creativecommons.org/licenses/by-sa/3.0/) license and the [Federal Aviation Administration](http://services.faa.gov/).*
104
+
*Re-used from [apievangilist.com](http://www.apievangelist.com) under a [Creative Commons](http://creativecommons.org/licenses/by-sa/3.0/) license and the [Federal Aviation Administration](http://services.faa.gov/).*
0 commit comments