PageRenderTime 62ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 1ms

/src/backend/web/templates/apidocs_overview.html

https://github.com/the-blue-alliance/the-blue-alliance
HTML | 110 lines | 93 code | 17 blank | 0 comment | 0 complexity | b4bb96563c3d2ac57b46a300bf10474a MD5 | raw file
  1. {% extends "base.html" %}
  2. {% block title %}Developer APIs - The Blue Alliance{% endblock %}
  3. {% block meta_description %}An overview of the developer APIs offered by The Blue Alliance{% endblock %}
  4. {% block content %}
  5. <div class="container">
  6. <div class="row">
  7. <div class="col-sm-3 col-lg-2">
  8. <div class="tba-sidenav-affixed">
  9. <h1 class="visible-xs end_header">The Blue Alliance Developer APIs</h1>
  10. <div class="tba-sidebar">
  11. <ul class="nav tba-sidenav">
  12. <li><a class="smooth-scroll" href="#getting-started">Getting Started</a></li>
  13. <li><a class="smooth-scroll" href="#apiv3">Read API (v3)</a></li>
  14. <li><a class="smooth-scroll" href="#webhooks">Webhooks</a></li>
  15. <li><a class="smooth-scroll" href="#trusted">Write API</a></li>
  16. <li><a class="smooth-scroll" href="#archives">Data Archives</a></li>
  17. <li><a class="smooth-scroll" href="#guidelines">Developer Guidelines</a></li>
  18. <li><hr></li>
  19. <li><a class="smooth-scroll" href="#apiv2">[Deprecated] Read API (v2)</a></li>
  20. </ul>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="col-xs-12 col-sm-9 col-lg-10">
  25. <h1 class="hidden-xs end_header">The Blue Alliance Developer APIs</h1>
  26. <p>The Blue Alliance cares about making our data publicly accessible via our various APIs. We want to help inspire people to build their own projects and get started with data analysis and software development. This page explains the APIs we provide and how to get started using them.</p>
  27. <h3>Need Help?</h3>
  28. <p>Here are some areas where you can ask the TBA developer community for assistance if you run into trouble.</p>
  29. <ul>
  30. <li><strong>Have questions?</strong> Ask a question in our <a href="https://the-blue-alliance.slack.com/">Slack</a> or start a thread on the <a href="https://groups.google.com/forum/#!forum/thebluealliance-developers">developer mailing list</a> or the <a href="https://www.chiefdelphi.com">Chief Delphi forums</a> if you're having trouble using the APIs</li>
  31. <li><strong>Found a bug, or have a feature request?</strong> <a href="https://github.com/the-blue-alliance/the-blue-alliance/issues/new">File an issue on GitHub</a> if you think you've found a problem or would like to request a feature.</li>
  32. <li><strong>Contribute to The Blue Alliance!</strong> The Blue Alliance is built as an open source project by a group of volunteers. If you'd like to help us build awesome things, <a href="https://github.com/the-blue-alliance/the-blue-alliance">check out our code and send us a pull request!</a></li>
  33. <li><a href="/contact">Contact us</a> with any other questions or comments you may have.</li>
  34. </ul>
  35. <h2 id="getting-started">Getting Started</h2>
  36. <p>Before you get started using The Blue Alliance APIs, you need to be familiar with a few elements of web technology. The Blue Alliance APIs work by having your computer send a web request to our servers asking for some piece of data, and our servers send the data back to your computer. You can ask for information about teams or matches, or even <em>send us</em> information, like letting us know there's a robot photo we should add to our data set.</p>
  37. <p>First, you need some way of sending HTTPS Requests to The Blue Alliance's servers. This will be your primary means of communication with TBA. For testing purposes, your web browser may suffice. For more advanced applications, you may want to use an external library. <a href="https://www.w3schools.com/jquery/jquery_ajax_intro.asp">jQuery</a> (Javascript), <a href="http://docs.python-requests.org/en/master/">Requests</a> (Python), and <a href="https://square.github.io/okhttp/">OkHttp</a> (Java) are all examples of HTTPS Libraries.</p>
  38. <p>You will also need to be familiar with <a href="https://en.wikipedia.org/wiki/Json">JSON</a>, a machine-readable format for sending and receiving data. Most of the TBA APIs use JSON-formatted data, so you should find out how to parse JSON text in the language of your choice.</p>
  39. <p>Once you've figured out how to make HTTPS requests, you will need to figure out how to manipulate request and response headers. These will be used to pass authentication keys to TBA and understand the cache life of returned data.</p>
  40. <a href="/apidocs/v3"><h2 id="apiv3">Read API (v3)</h2></a>
  41. <p>Most people want to pull event listings, team information, match results, or statistics from The Blue Alliance to use in their own application. The read API is the way to do this. This API exposes almost all of the data you see on TBA to your application in a machine-readable format called JSON.</p>
  42. <h3>API Endpoint</h3>
  43. <p>All requests should be made to the base URL <code>https://www.thebluealliance.com/api/v3</code>.</p>
  44. <h3>Authentication</h3>
  45. <h4><code>X-TBA-Auth-Key</code> Header</h4>
  46. <p>Generate an access token on your <a href="/account">Account Dashboard</a> in the Read API Keys section. This key needs to be passed along with each request you make in the header (or URL parameter) <code>X-TBA-Auth-Key</code>.</p>
  47. <p>If you are logged in to your TBA account, you can access the API without a key by simply navigating to an API URL in your web browser</p>
  48. <h3>Caching</h3>
  49. <h4><code>ETag</code> and <code>If-None-Match</code> Headers</h4>
  50. <p>All API responses have an <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag"><code>ETag</code></a> header which specifies the version of the most recent response. When making repeated calls to a particular endpoint, you should set the <code>If-None-Match</code> header in your request to the <code>Etag</code> value from the previous call to that endpoint. On the first call, <code>If-None-Match</code> does not need to be set.</p>
  51. <p>Consumers of the TBA API are highly encouraged to make use of these headers. If the server determines that no data has been updated, it returns a <code>304 Not Modified</code> response with an empty body, saving both the server and the consumer time and bandwidth.</p>
  52. <p>For more details, see <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag">Mozilla's ETag reference</a>.</p>
  53. <h4><code>Cache-Control</code> Header</h4>
  54. <p>If your application makes many queries to the TBA API and you are capable of caching the results locally, the
  55. Cache-Control header will provide guidance on how long the API response can remain valid in a local cache. In
  56. particular, the <code>max-age</code> value in the <code>Cache-Control</code> header contains the number of
  57. seconds the API result should be considered valid for. See also
  58. <a href="https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching?hl=en#cache-control">
  59. Google's Cache-Control reference</a>.</p>
  60. <h3>Client Libraries</h3>
  61. <p>The Blue Alliance automatically builds and publishes client libraries to make it easier for you to get started using APIv3. The libraries are automatically generated by <a href="http://swagger.io/swagger-codegen/">Swagger Codegen</a> and are not provided with any guarantee of support from The Blue Alliance and are not guaranteed to be complete implementations of the API. They are merely provided as a convenience to developers looking to get started and can be found <a href="https://github.com/TBA-API">on the TBA-API GitHub</a></p>
  62. <a href="/apidocs/webhooks"><h2 id="webhooks">Webhooks</h2></a>
  63. <p>The TBA API also includes support for <a href="https://en.wikipedia.org/wiki/Webhook">webhooks</a>, or HTTP callbacks. When an item of interest changes, TBA can send a HTTP request to your server, allowing your application to react instantly to the change. This can save both your client and our server time and processing power, as it can reduce the need to poll the API. See <a href="/apidocs/webhooks">this page</a> for more documentation on webhooks.
  64. <a href="/apidocs/trusted"><h2 id="trusted">Write API (v1)</h2></a>
  65. <p>The Blue Alliance provides a Write API, called the Trusted API, which allows users to import data to The Blue Alliance for archival. For example, many offseason events use the Trusted API to provide real-time match results to their audience. To get started, you need to <a href="request/apiwrite/">request access tokens</a> for your desired event. These need to be used when constructing each request.</p>
  66. <p>To see the complete specification of the trusted API, refer to the <a href="/apidocs/trusted">full documentation</a>.</p>
  67. <a href="https://github.com/the-blue-alliance/the-blue-alliance-data"><h2 id="archives">Data Archives</h2></a>
  68. <p>If you're looking to run SQL queries over the TBA database, you can use this <a href="/bigquery">BigQuery</a> dataset. This contains a full replica of the TBA database, so the possibilities are endless!</p>
  69. <p>If these APIs are too complex for your application, The Blue Alliance also provides periodic data archives in comma separated value (CSV) format. The data provided here is less detailed, but is simpler to use in Excel spreadsheets, for example.</p>
  70. <p>You can find these data archives <a href="https://github.com/the-blue-alliance/the-blue-alliance-data">on the-blue-alliance/the-blue-alliance-data GitHub</a>.</p>
  71. <h2 id="guidelines">TBA Developer Guidelines</h2>
  72. <p>Were excited to see you building things on top of The Blue Alliances APIs! We love seeing the creativity and utility in these projects. We have a few developer guidelines to help guide your work.</p>
  73. <ol>
  74. <li>
  75. <strong>Branding</strong>
  76. <ul>
  77. <li>We want people to know which apps are official The Blue Alliance apps, and which apps are powered by our API, but not supported by us.</li>
  78. <li>Please do not use The Blue Alliance, TBA, or The Blue Alliance lamp logo in the name or brand identity of your app.</li>
  79. <li>If youd like your project to become an official part of The Blue Alliance, please reach out to us by <a href="https://the-blue-alliance.slack.com/">joining our Slack</a>. Wed love to talk more!</li>
  80. </ul>
  81. </li>
  82. <li>
  83. <strong>Attribution</strong>
  84. <ul>
  85. <li>Please note that your project is Powered by The Blue Alliance with a link back to <a href="https://www.thebluealliance.com">thebluealliance.com</a>. This helps people discover our site, lets your users know where to report data issues, and helps more people get inspired to build on top of our APIs.</li>
  86. <li>If you offer links out of your app for more details about teams, events, or other data, we ask that you consider linking back to corresponding pages on The Blue Alliance.</li>
  87. </ul>
  88. </li>
  89. </ol>
  90. </div>
  91. </div>
  92. </div>
  93. {% endblock %}