Git Product home page Git Product logo

api-standards's Introduction

GSA API Standards

This document captures GSA's recommended best practices, conventions, and standards for Application Programming Interfaces (APIs). Projects should start by addressing API Security, followed by implementing the Mandatory Items and Mandatory For New Public APIs. After addressing those, review Other Considerations for additional advice.

Contents

About These Standards

These standards are forked from the 18F API Standards. They are also influenced by several other sources, including the White House API Standards and best practices from the private sector.

The standards are a roadmap not a roadblock

These standards are intended to streamline the process for GSA organizations to publish new APIs by providing practical and pragmatic advice. We believe these standards will benefit GSA API development and provide consistency.

They primarily focus on RESTful APIs

Most of the content in these standards relates to "RESTful" APIs. However, many of the standards are equally appropriate for other types of web service.

A few specific recommendations are provided for SOAP web services, and we encourage the GSA community to share more recommendations.

They don't look under the covers

Because APIs may be developed with multiple technologies, these standards avoid details internal to the development of the application or unique to a development platform. They generally focus on the "externals" that will be exposed to users.

API Category Definitions

For the purposes of these standards, we use the following definitions:

  • Non Public APIs - Available only to GSA applications and users.
  • Public APIs - Available to non-GSA applications and users. Examples include the general public, other agencies, or private companies.
  • Limited Partner APIs - Available to two or fewer non-GSA applications or users. Examples include other agencies or private companies.

API Security

API Security is governed by the GSA IT Security Procedural Guide: API Security CIO-IT Security-19-93. Reference that guide for security related topics such as HTTPS encryption, authentication, and authorization.

Mandatory Items for Public APIs

These are mandatory for GSA public APIs, with exceptions where noted.

1. Add Your API To The GSA API Directory

(Public APIs) A directory of GSA public APIs is available at open.gsa.gov/api. Add your API to this directory by posting an issue or pull request in the GitHub repository.

Part of this process is to first complete the neccessary steps to add your GitHub Account to the GSA Organization and then send an email to the CTO team to have your account added to the open-gsa-redesign User Group. The steps are documented on the Adding API Documentation GitHub page.

2. Use The api.data.gov Service

(Public APIs) The api.data.gov service is an API management service for federal agencies. GSA APIs should use the api.gsa.gov base domain with this service. By having the api.gsa.gov base URL as a proxy to developers, this also makes it easier to update and maintain the API in the future since you can update the underlying system and URLs without exposing it to the public. In some cases, other specific base domains can be established with this service for GSA APIs.

Implementing With Your API

Initially, this service can be added as a new version of the URL, and then existing users can be transitioned to the new URL. For help setting this up, contact the api.data.gov team at [email protected].

Additional Benefits

The api.gsa.gov service also provides:

  • API key management
  • rate limiting (throttling)
  • gathering usage statistics (analytics)

Keys managed by api.data.gov can be re-used with other APIs hosted by this service, which reduces complexity for users. This service also allows the use of a DEMO_KEY for unauthenticated access, without keys, which reduces the "Time To First Hello World" for developers using your API.

Exceptions: Not required for SOAP APIs. However, it may still provide value to your SOAP API.

3. Provide Support For Versioning

All APIs must support versioning. The recommended method of versioning REST APIs is to include a major version number in the URL path. For example "/v1/". An example of this method can be found at: https://gsa.github.io/sam_api/sam/versioning.html.

Major and Minor Versions

Major versions (e.g. v1, v2) should be reserved for breaking changes and major releases. Minor versions (eg. 1.1, 2.3) are not required, but can provide additional information about the API. If used, they should not be in the URL, but should be in the HTTP Headers.

Breaking Changes (backwards-incompatible)

Any changes made to a specific version of your API should not break your contract with existing users. If you need to make a change that will break that contract, create a new major version.

Examples of Breaking Changes for REST APIs:

  • Removing an HTTP method
  • Removing or renaming a field in the request or response message
  • Removing or renaming a query parameter
  • Changing the URL or URL format

Examples of Breaking Changes for SOAP web services:

  • Removing an operation
  • Renaming an operation
  • Changing the parameters (in data type or order) of an operation
  • Changing the structure of a complex data type.

Non-Breaking Changes (backwards-compatible)

It is not necessary to increment the major API version for non-breaking changes. Non-breaking changes can be reflected in a minor version, if used.

Examples of Non-Breaking Changes for REST APIs:

  • Adding an HTTP method
  • Adding a field to a request message
  • Adding a field to a response message
  • Adding a value to an enum
  • Adding a query parameter

Examples of Non-Breaking Changes for SOAP web services:

  • Adding a new WSDL operation to an existing WSDL document.
  • Adding a new XML schema type within a WSDL document that are not contained within previously existing types

Support for Previous Versions

Leave at least one previous major version intact. And communicate to existing users to understand when previous versions will be decommissioned.

Prototype or Alpha Versions

Use "/v0/" to represent an API that is in prototype or alpha phase and is likely to change frequently without warning.

4. Provide Public Documentation

The developer's entry point to your API will likely be the documentation that you provide.

Your API documentation should provide:

  • An overview of the contents of the API and the data sources.
  • Public APIs should provide production URLs for accessing the API. (Non-public APIs would exclude this.)
  • Required parameters and defaults.
  • A description of the data that is returned.
  • A description of the error codes that are returned, and their meaning.

Additional nice-to-haves include:

  • Explanation of key management and a sample key.
  • Description of update frequency.
  • Interactive documentation to demonstrate sample calls.
  • Sample client code for consuming the API in common languages.

5. Provide A Feedback Mechanism That Is Clear and Monitored

Have an obvious mechanism for clients to report issues and ask questions about the API. It is critical to respond to issues posted or queries submitted by developers. This demonstrates that the API can be counted on for production usage. If an immediate fix (or even a developer to investigate) is not readily available, respond anyway. Developers will be glad to know when you'll be able to take a look.

When using GitHub for an API's code or documentation, use the associated issue tracker. In addition, publish an email address for direct, non-public inquiries.

If you don't have a support channel specific to your API, you can use the issue tracker at GSA-APIs. Be sure your support team subscribes to issues there.

6. Provide An OpenAPI Specification File

For REST APIs, The API documentation should provide a clear link to the API's OpenAPI Specification file. This specification was formerly known as the Swagger specification. This specification file can be used by development or testing tools accessing your API.

Using Version 2.0 or later of the specification is recommended. Information about versions can be found here: OpenAPI Specification Revision History.

Exceptions: Not required for SOAP APIs.

7. Follow The Standard API Endpoint Design

For REST APIs, An "endpoint" is a combination of two things:

  • The verb (e.g. GET , POST, PUT, PATCH, DELETE)
  • The URL path (e.g. /articles)

The URL path should follow this pattern for a collection of items: (base domain)/{business_function}/{application_name}/{major version}/{plural_noun}

An example would be: https://api.gsa.gov/financial_management/sample_app/v1/vendors

The URL path for an individual item in this collection would default to: (base domain)/{business_function}/{application_name}/{major version}/{plural_noun}/{identifier}

An example would be: https://api.gsa.gov/financial_management/sample_app/v1/vendors/123

Exceptions: Not required for SOAP APIs. Not required for APIs that were in progress or production prior to December 2018.

Recommended Items for Public APIs

1. Provide a Testing UI

When you have an OpenAPI specification file (mandatory for public APIs), there are tools that can use this specification file to automatically generate a page where your users can try out your API without too much effort. Swagger UI is one such tool; here is an example.

We strongly recommend implementing this item, as it provides a significant enhancement to developer experience and helps ensure proper use of your API. Swagger UI can be implemented on any website, even a static site, with the inclusion of a few JavaScript and CSS files.

See the Swagger UI project for installation and configuration instructions.

After downloading Swagger UI, you generally will want a page that loads the Swagger UI and your OpenAPI specification file:

<!-- in the HEAD of the page -->
<link rel="stylesheet" type="text/css" href="swagger-ui.css" >

<!-- in the BODY of the page -->
<div id="swagger-ui"></div>
<script src="swagger-ui-bundle.js"></script>
<script src="swagger-ui-standalone-preset.js"></script>
<script>
  window.onload = function() {
    // openapi.yaml is your OpenAPI specification file (can also be a JSON file)
    const ui = SwaggerUIBundle({
      url: "openapi.yaml",
      dom_id: '#swagger-ui',
      presets: [
        SwaggerUIBundle.presets.apis,
        SwaggerUIBundle.SwaggerUIStandalonePreset,
      ],
      layout: "StandaloneLayout"
    })
    window.ui = ui
  }
</script>

Depending on your site, the above is roughly all you need to generate the API testing tool.

Mandatory Items for Limited Partner APIs

1. Provide Public or Protected Documentation

If details of API need to be secured from public viewing, the API documentation can be on a web page that is only accessible to authorized users of the API. This protected documentation may be mentioned on a separate public page, or directly linked from the API Directory.

Your API documentation should provide:

  • An overview of the contents of the API and the data sources.
  • Required parameters and defaults.
  • A description of the data that is returned.
  • A description of the error codes that are returned, and their meaning.

Additional nice-to-haves include:

  • Explanation of key management and a sample key.
  • Description of update frequency.
  • Interactive documentation to demonstrate sample calls.
  • Sample client code for consuming the API in common languages.

2. Provide A Feedback Mechanism That Is Clear and Monitored

On the public or protected documentation page, include a method for users to report issues and ask questions about the API. It is critical to respond to issues posted or queries submitted by developers. This demonstrates that the API can be counted on for production usage. If an immediate fix (or even a developer to investigate) is not readily available, respond anyway. Developers will be glad to know when you'll be able to take a look.

Recommended Items for Limited Partner APIs

The following items will be beneficial to the users of your APIs. (Full details of these items are linked to the previous section of this document.)

Add Your API To The GSA API Directory Use The api.data.gov Service Provide Support For Versioning Provide An OpenAPI Specification File Follow the Standard API Endpoint Design

Other Considerations

Design for common use cases

For APIs that syndicate data, consider several common client use cases:

  • Bulk data. Clients often wish to establish their own copy of the API's dataset in its entirety. For example, someone might like to build their own search engine on top of the dataset, using different parameters and technology than the "official" API allows. If the API can't easily act as a bulk data provider, provide a separate mechanism for acquiring the backing dataset in bulk, such as posting the full dataset on data.gov.
  • Staying up to date. Especially for large datasets, clients may want to keep their dataset up to date without downloading the data set after every change. If this is a use case for the API, prioritize it in the design.
  • Driving expensive actions. What would happen if a client wanted to automatically send text messages to thousands of people or light up the side of a skyscraper every time a new record appears? Consider whether the API's records will always be in a reliable unchanging order, and whether they tend to appear in clumps or in a steady stream. Generally speaking, consider the "entropy" an API client would experience.

Using one's own API

The best way to understand and address the weaknesses in an API's design and implementation is to use it in a production system.

Whenever feasible, design an API in parallel with an accompanying integration of that API.

A few methods to accomplish this include:

  • Identifying an internal GSA organization to use your API while also publishing it publicly.
  • Creating a web page with a search feature that uses the API.
  • Modifying existing web pages or web applications to use the API instead of direct access to the database.

Developers Are Your End Users

Consider developers who will be using your APIs. Their path to using your API will include discovery and initial investigation, sample API calls, development and testing, deployment and production usage. Consider each of these functions in your documentation, support, and change notification process. Consider performing formal API Usability Testing to understand the developer experience in using your API. More information about this type of testing is available here: API Usability Testing.

Notifications of updates

Have a simple mechanism for clients to follow changes to the API.

Common ways to do this include a mailing list or a persistent issue in the GitHub repository that users can subscribe to. For example: Notification Thread: Updates to GSA APIs

Decommission unsupported APIs

If an API can no longer be supported, consider decommissioning the API and removing the documentation. If the API will remain available for historical purposes without support, update the documentation to reflect this.

Notify current users and update documentation before breaking changes or decommissioning

If an API is going to be decommissioned, retired, or changed in such a way that current users will be impacted, it is critical that those users be notified in advance so that they can prepare for the change instead of experiencing an unexpected interruption. The most common situations where this happens is if an API is going to be decommissioned or if an update to the API will change how the API functions (note that this is where Versioning is important). If these users aren't notified, their application that consumes the API may break and they may suffer significant consequences from their application's resulting downtime. Furthermore, experiencing this may seriously degrade the trust that the developer has in GSA's API programs and may cause them to avoid our services going forward if they feel that they cannot rely on them.

In addition to updating the API documentation in advance with a highly visible notice, it is important to use API analytics to see which API keys have consumed the service in recent months. You can then use the email addresses associated with each key to send (preferably more than one) notification of the upcoming change. Note that posting a notice on the API documentation is not sufficient by itself, as many current users will not necessarily revisit the documentatation. Proactive notification of recent users is essential.

Use JSON

JSON is an excellent, widely supported transport format, suitable for many web APIs.

Supporting JSON and only JSON is a practical default for APIs, and generally reduces complexity for both the API provider and consumer.

General JSON guidelines:

  • Responses should be a JSON object (not an array). Using an array to return results limits the ability to include metadata about results, and limits the API's ability to add additional top-level keys in the future. If multiple results are returned, they can be included as an Array in the JSON object.
  • Don't use unpredictable keys. Parsing a JSON response where keys are unpredictable (e.g. derived from data) is difficult, and adds friction for clients.
  • Use consistent case for keys. Whether you use under_score or CamelCase for your API keys, make sure you are consistent.

Use a consistent date format

And specifically, use ISO 8601, in UTC.

For just dates, that looks like 2013-02-27. For full times, that's of the form 2013-02-27T10:00:00Z.

This date format is used all over the web, and puts each field in consistent order -- from least granular to most granular.

HTTP Response Codes

The following are recommended HTTP Response Codes that API should return. They are based on the OWASP REST Security Cheat Sheet from December 2018.

Return Code Message Description
200 OK Response to a successful REST API action. The HTTP method can be GET, POST, PUT, PATCH or DELETE.
201 Created The request has been fulfilled and the resource created. A URL for the created resource is returned in the Location header.
202 Accepted The request has been accepted for processing, but processing is not yet complete
400 Bad Request The request is malformed, such as a message body format error, missing headers, etc.
401 Unauthorized Wrong or no authentication ID/ password provided.
403 Forbidden Used when the authentication succeeded but the authenticated user does not have permission to the requested resource.
404 Not Found When a non-existent resource is requested.
406 Unacceptable The client presented a content type in the Accept header which is not supported by the server API.
405 Method Not Allowed The error for an unexpected HTTP method. For example, the REST API is expecting HTTP GET, but HTTP PUT is used.
413 Payload Too Large Used to signal that the request size exceeded the given limit (e.g. regarding file uploads and to ensure that the requests have reasonable sizes).
415 Unsupported Media Type The requested content type is not supported by the REST service. This is especially effective when you are working primary with JSON or XML media types.
429 Too Many Requests The error is used when there may be a DOS attack detected or the request is rejected due to rate limiting.
500 Internal Server Error An unexpected condition prevented the server from fulfilling the request. Be aware that the response should not reveal internal information that helps an attacker, e.g. detailed error messages or stack traces.
501 Not Implemented The REST service does not implement the requested operation yet
502 Service Unavailable The REST service is temporarily unable to process the request. Used to inform the client it should retry at a later time.

Note: GSA APIs should be using the api.data.gov service as a proxy between the client and the API. That service will return additional HTTP codes, prior to the request reaching the base API. Here is a list of those code: https://api.data.gov/docs/errors/

Pagination

If pagination is required to navigate datasets, use the method that makes the most sense for the API's data.

Common patterns:

  • page and per_page. Intuitive for many use cases. Links to "page 2" may not always contain the same data.
  • offset and limit. This standard comes from the SQL database world, and is a good option when you need stable permalinks to result sets.
  • since and limit. Get everything "since" some ID or timestamp. Useful when it's a priority to let clients efficiently stay "in sync" with data. Generally requires result set order to be very stable.

Metadata

Include enough metadata so that clients can calculate how much data there is, and how and whether to fetch the next set of results.

Example of how that might be implemented:

{
  "results": [ ... actual results ... ],
  "pagination": {
    "count": 2340,
    "page": 4,
    "per_page": 20
  }
}

Use UTF-8

Just use UTF-8.

Handle accented characters or "smart quotes" in API output, even if they're not expected.

An API should tell clients to expect UTF-8 by including a charset notation in the Content-Type header for responses.

An API that returns JSON should use:

Content-Type: application/json; charset=utf-8

Enable CORS

For clients to be able to use an API from inside web browsers, the API must enable Cross-Original Resource Sharing (CORS).

For the simplest and most common use case, where the entire API should be accessible from inside the browser, enabling CORS is as simple as including this HTTP header in all responses:

Access-Control-Allow-Origin: *

It's supported by every modern browser, and will Just Work in many JavaScript clients.

For additional guidance on CORS, see the GSA IT Security Procedural Guide: API Security CIO-IT Security-19-93.

API Testing

At its most basic level, API testing is intended to reveal bugs: inconsistencies or deviations from the expected behavior. Continuous testing is also very important to make sure it continues to work when the public has access to it. The risk of putting a bad, and potentially insecure, product on the market is greater than the cost to test it.

Types of API Testing

  • Functionality testing โ€” the API works and does exactly what itโ€™s supposed to do.
  • Reliability testing โ€” the API can be consistently connected to and lead to consistent results.
  • Load testing โ€” the API can handle a large amount of calls.
  • Creativity testing โ€” the API can handle being used in different ways.
  • Security testing โ€” the API has defined security requirements including authentication, permissions and access controls.
  • Proficiency testing โ€” the API increases what developers are able to do.
  • API documentation testing โ€” also called discovery testing, the API documentation easily guides the user.
  • Negative Testing โ€” checking for every kind of wrong input the user can possibly supply.

SOAP Web Services

  • Provide a WSDL.

    Most platforms will provide this by default out of the box. Leave it active unless you have a strong reason not to. A useful convention is that the WSDL will be available at: {URL Path)?wsdl

  • Provide documentation for SOAP web services.

    Users of SOAP web services need documentation, just like REST users.

  • See examples of versioning of SOAP web services above.

Future Topics

Several additional API related topics continue to emerge and will be considered for future updates to these standards.

That list includes:

  • Microservices
  • Hypermedia and HATEOAS
  • Responsive APIs
  • GraphQL

What are we missing?

If you see a future topic we need to consider, take a look at our contributing page for instructions to share that info.

api-standards's People

Contributors

adelevie avatar angjenkins avatar arowla avatar bengm avatar carloseberhardt avatar gbinal avatar gplocke avatar jabley avatar jcastle-zz avatar jfredrickson avatar jrep avatar konklone avatar leahbannon avatar lenatrudeau avatar lindsayyoung avatar monfresh avatar noahkunin avatar paulswartz avatar philipashlock avatar readmecritic avatar traviscarden avatar wardi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-standards's Issues

Best practices for testing

What are the best practices for:

  • Providing a test environment to users for your API
  • Test data
  • Test credentials

Discuss....

Add implementation profiles or playbooks

As teams implement these standards on specific technology stacks, they can contribute back to the rest of the organization by demonstrating what type of coding or configuration was necessary. They could document these in "implementation profiles" or "implementation playbooks".

For example, how do you "Enable CORS" with node.js/express? How do you put the version in the path for JAX-RS?

I am currently doing this for a technology stack in IC and it is a similar process to what we did previously on the Prototype City Pairs API standards page.

Review GSA's API entries on data.gov for freshness

Migrate to the GSA API Documentation Template

Per the GSA API Standards, we have an API Documentation Template. It's open source, functional, easy to clone, developer friendly, and includes a useful public feedback mechanism for users of the API.

We've made some initial progress adopting this at GSA, but it would be good to go all the way! That way, GSA can put forward a more consistent developer experience and GSA API teams will have one less thing to think about. Tracking implementation here:

Great read! Just one issue - link is broken

Hi @rdgsa

In the paragraph:

Add Your API To The GSA API Directory
A directory of GSA public APIs is available at open.gsa.gov/developer.

  • the open.gsa.gov/developer link is broken

Update link to GSA API directory repo

The standards explain that the process for adding an API to the directory involves the github repo of the open.gsa.gov web site. There is a current redesign of that site underway with a separate repo.

When the new open.gsa.gov site goes live, update the repo name in the API Standards.

Create examples of api versioning

It would be helpful for consumers of these standards to have documented examples of api versioning. For example, what is considered a minor change, major change, etc.

Good examples of this are provided by Karl Fogel in Producing Open Source Software: How to Run a Successful Free Software Project

GET Request Examples

https://exampleapi.gov/person

New Version Number (Major Change Criteria)

  • the output for a given response changes its overall organization.

Old

{
    'name': 'Jane',
    'phone': '555-5555'
}

New

{
    'name': 'Jane',
    'phoneNumbers': {
        'home': '555-5555',
        'work': '333-9999'
    }
}

Minor version, no new version number needed

  • New fields may be present but the construction of existing objects/arrays does not change

Old

{
    'name': 'Jane',
    'phone': '555-5555'
}

New

{
    'name': 'Jane',
    'phone': '555-5555',
    'zipCode': '12345'
}

POST Request Examples

Major changes

  • Existing validation rules change, new fields or formats are required

Minor version changes

  • Updating error messages (text output rather than error codes)
  • Adding new fields to the output, not changing the structure

Do a fresh pass at articulating and engaging around best practices

We've now gone through to make sure that all GSA APIs have met the requirements of the API Standards, but a next worthwhile focus would be on articulating some best practices for API documentation and going through all of the API docs to see where we have holes and pitching the API programs to update their docs accordingly.

The 'Other Considerations' section of the API Standards already seems to be where we're articulating some best practices, so here's a proposed path forward:

  • Clone the current inventory of public APIs that we use for the Standards, to start a tracking doc for the best practices.
  • Click through all of the docs and look back through previous API Usability sessions to brainstorm edits to the Other Considerations section.
  • Make columns for each best practice in the tracking doc.
  • Engage each API program with suggested edits/pull requests.

Take off the "draft" in the label

Need to determine when to take "draft" off of the standards and the references to them on tech.gsa.gov.

A conversation probably needs to occur regarding the process for removing that label and what it signifies.

Add security playbook or SOP

API Standards should explain the process of navigating security for a new system with APIs or a new API to an existing system.

Could involve:

  • Security standards
  • Workflows for security reviews, docs, authorizations.

@jcastle this came from API tech talk today.

Verify proposed endpoints match API Standards

@gbinal I think it would be good to make sure the proposed endpoints in the endpoint design follow the URL path in the API standards. It seems to me that the "systems" in the proposed path doesn't match our standard of using {business_function}/{application_name}/{version}/{plural_noun}

Assorted feedback

Moving feedback from @pstingley into its own issue.


  1. Question: Are all web services RESTful? What about SOAP based web services? Should this be scoped
    to refer only to RESTful web services? Even though RESTful web services are popular right now, does
    the scope of this document limit other future web services that might not be based on REST?

  2. When people say "RESTful" nowadays, they really mean designing simple, intuitive endpoints that represent unique functions in the API.
    Disagree: When people say "RESTful" these days, they are making a
    specific statement about the way the interface works. IAW REST protocol.

  3. Notifications of updates
    Have a simple mechanism for clients to follow changes to the API.
    Common ways to do this include a mailing list, or a dedicated developer blog with an RSS feed.

This is a poor idea because it requires people or computers to somehow
know of information from some other source. Documentation needs to be
atomically related to the service or else the service and its documentation
will become disassociated. One suggestion is that all documentation be
located within the /docs path, available via the get method.

  1. In the section titled: API Endpoints, why are the only verbs allowed:
    (e.g. GET or POST)? There are only 5 verbs in REST. Adding the remaining
    three words verbs goes a long way towards clarifying the set of allowed
    terms.

  2. Endpoint URLs should advertise resources, and avoid verbs.
    Disagree: For 40 years the interface of Internet based services have been the
    operation of the service itself, while documentation has been located
    in a /docs directory. Changing the default behavior of web services
    at this stage will break lots of things and will result in unnecessarily
    complex coding.

  3. The FBOpen link to https://pages.18f.gov/fbopen/ gives a 404: Page not
    found error.

  4. The FDA example violates the: Avoid single-endpoint APIs. Don't jam multiple operations into the same endpoint with the same HTTP verb. rule

  5. Add that a documentation page (preferably in the /docs directory) will be provided so that spiders
    can index all web services throughout the domain.

Filtering best practices and documentation

It would be a useful enhancement to provide recommendations on the filtering syntax used by APIs.

For example, the Discovery API (https://discovery.gsa.gov/api/) can be can be filtered by top-level parameters of the results. However, it is not clear how or if JSON result sub-properties can be used as conditionals.

Integrate api.data.gov for API keys and analytics

Per the GSA API Standards, it's encouraged to integrate api.data.gov for API keys and analytics. It's open source, functional, already set up for cross-GSA use, and easy to implement.

We've made some initial progress adopting this at GSA, but it would be good to go all the way! That way, GSA can put forward a more consistent developer experience and GSA API teams will have robust API analytics and be able to stay in touch with the developers who use their APIs. Tracking implementation here:

Refine endpoints design

  • Add functionality for method-based endpoints (good explanation of this in API book I read recently)
  • Explain difference between nouns returned (in path) and filters (query string)

Ensure each API is represented on gsa.gov/developer and data.gov

Per the GSA API Standards, we have an important responsibility to ensure that our APIs are readily discoverable by those who might use them. Two important steps for this are adding each API to GSA's directory of APIs and to Data.gov. These are the two places that a potential user should always be able to go in order to find an API.

We've made some initial progress adopting this at GSA, but it would be good to go all the way! That way, GSA can provide a developer-friendly experience and ensure its compliance with policy. Tracking implementation here:

Communicating stability and support of an API

This is an issue for discussion on this topic. Please post your feedback as comments below

For a consumer to begin using an API, it is important that they know how much they can rely on it.

The following are my own definitions of two important qualities that allow an API consumer to rely on it:

Stability - The API will continue to operate in its current state for a reasonable period of time.

Support - Questions or issues submitted by an API Consumer will be responded to and resolved. (https://github.com/GSA/api-standards#avoid-an-api-ghost-town-responding-to-issues-and-questions)

  • Assumption 1: Different APIs will be on different points of these two spectrums throughout their lifecycle from development to full support to deprecation.

  • Assumption 2: the most critical point is to communicate accurately and realistically where an API falls on those spectrums. In the absence of clear information, the API Consumer will be forced to make assumptions, which may be overly optimistic or pessimistic.

Discussion (the discussion is about communicating, not addressing the stability or support itself):

  • Question 1: What is the best way for a GSA API Owner to accurately communicate the current stability of an API?
  • Question 2a: What is the best way for a GSA API Owner to accurately communicate the current support of an API?
  • Question 2b: What measures can GSA put in place to identify APIs that are not being supported any longer and may need to be decommissioned or marked historical? (https://github.com/GSA/api-standards#decommission-unsupported-apis)

{application_name} included in URL

Do we have a good sense of whether this is a good idea - that is, are we exposing backend concerns on the frontend?

Should we instead look to the business function + noun to be unique across applications?

Guidance for marking an API as a prototype

Add guidance for methods that can be used to mark an API as a prototype, non-production API.

A few methods we have implemented with the City Pairs Prototype:

  • API documentation includes "Prototype" in the title.
  • API documentation includes the following statement "It is not a production API, and it is not intended for use by the public."
  • API version is "V0"
  • Response object contains a message "This is a prototype API. These results are for demonstration purposes only." in the payload.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.