Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move to top-level REST directory and update formatting #446

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions api/rest/_rest_api_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
layout: default
title: REST API page template
nav_order: 999
parent: REST
grand_parent: API
published: false
---

# /_VERSION_/_ENDPOINT_

One line summary of what it does.

Longer details if necessary can go in a short paragraph here. This is where to document any particular nuances in behavior or to provide special notes for end users. If there’s any special Data Commons terminology to define (e.g. triples), that should be done here as well.

See also:
To do some other related, but different thing, see [/_VERSION_/_OTHER_END_POINT_](link)


## Request

div class="api-tab">
<button id="get-button" class="api-tablink" onclick="openTab(event, 'GET-request')">
GET request
</button>
<button id="post-button" class="api-tablink" onclick="openTab(event, 'POST-request')">
POST request
</button>
</div>

<div id="GET-request" class="api-tabcontent api-signature">
https://api.datacommons.org/<var>VERSION</var>/<var>ENDPOINT</var>?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&<var>PARAM1</var>&<var>PARAM2</var>
</div>

<div id="POST-request" class="api-tabcontent api-signature">
URL:
https://api.datacommons.org/<var>VERSION</var>/<var>ENDPOINT</var>

Header:
X-API-Key: AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI

JSON data:
{
"<var>PARAM1</var>": [
...
],
"<var>PARAM2</var>": "..."
}
</div>

<script src="/assets/js/syntax_highlighting.js"></script>
<script src="/assets/js/api-doc-tabs.js"></script>

### Path parameters

| Name | Description |
| --------------------------------------------------- | ----------------------------- |
| <var>PARAM1</var> <br /> <required-tag>Required</required-tag> | description of parameter here |
| <var>PARAM2</var> <br /> <required-tag>Required</required-tag> | description of parameter here |
{: .doc-table }

### Query parameters

| Name | Type | Description |
| -------------------------------------------------- | ---- | ------------------------- |
| key <br /> <required-tag>Required</required-tag> | string | Your API key. See the [page on authentication](link) for a demo key, as well as instructions on how to get your own key. |
| _QUERY_ <br /> <optional-tag>Optional</optional-tag> | type | description of query here |
{: .doc-table }

## Response

The response looks like:

```json
{
"value": 1234,
"date": "YYYY-MM-DD",
"Mmetadata": {}
}
```
{: .response-signature .scroll}

### Response fields

| Name | Type | Description |
| -------- | ------ | -------------------------- |
| _FIELD_ | _TYPE_ | description of output here |
{: .doc-table}

## Examples

### Example 1: Description of what we're trying to show

One sentence explanation of details of the example. Use GET or POST request as appropriate.

Request:
{: .example-box-title}
<pre>
$ curl --request GET --url \
'https://api.datacommons.org/<var>VERSION</var>/<var>ENDPOINT</var>?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&<var>QUERY</var>=<var>VALUE</var>...'
</pre>
{: .example-box-content .scroll}

Response:
{: .example-box-title}
```json
{
"date": "2020",
"value": 331449281,
"facet": {
"importName": "USDecennialCensus_RedistrictingRelease",
"provenanceUrl": "https://www.census.gov/programs-surveys/decennial-census/about/rdo/summary-files.html",
"measurementMethod": "USDecennialCensus"
}
}
```
{: .example-box-content .scroll}
96 changes: 0 additions & 96 deletions api/rest/v1/_rest_api_template.md

This file was deleted.