-
Notifications
You must be signed in to change notification settings - Fork 37
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
Rest stat vars union documentation #159
Closed
KilimAnnejaro
wants to merge
17
commits into
datacommonsorg:master
from
KilimAnnejaro:rest-stat-vars-union
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
cd08679
Merge pull request #1 from datacommonsorg/master
KilimAnnejaro 31d9420
Merge pull request #2 from datacommonsorg/master
KilimAnnejaro fbded7a
Merge pull request #3 from datacommonsorg/master
KilimAnnejaro d4c5099
Merge pull request #4 from datacommonsorg/master
KilimAnnejaro 7137dc0
Merge branch 'master' of https://github.com/datacommonsorg/docsite
KilimAnnejaro 6edef21
Merge branch 'master' of https://github.com/datacommonsorg/docsite
KilimAnnejaro 87ed4e1
Merge branch 'master' of https://github.com/datacommonsorg/docsite
KilimAnnejaro 9277141
Merge branch 'master' of https://github.com/datacommonsorg/docsite
KilimAnnejaro 82836ae
Merge branch 'master' of https://github.com/datacommonsorg/docsite
KilimAnnejaro 8a95eff
Merge branch 'master' of https://github.com/datacommonsorg/docsite
KilimAnnejaro 3b50a3d
Merge branch 'master' of https://github.com/datacommonsorg/docsite
KilimAnnejaro db692a0
Merge branch 'master' of https://github.com/datacommonsorg/docsite
KilimAnnejaro e6bb85d
Merge branch 'master' of https://github.com/datacommonsorg/docsite
KilimAnnejaro 7fe3ca6
union
KilimAnnejaro 2f5a98f
remove tabs.js
beets a9860a2
Merge branch 'master' into rest-stat-vars-union
beets 25d310f
Merge branch 'master' into rest-stat-vars-union
KilimAnnejaro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
layout: default | ||
title: Union of Place Statistical Variables | ||
nav_order: 13 | ||
parent: REST | ||
grand_parent: API | ||
--- | ||
|
||
# Retrieve all statistical variables available for a particular place | ||
|
||
Given a list of [`Place`](https://datacommons.org/browser/Place) DCIDs, | ||
(e.g. any [`State`](https://datacommons.org/browser/State), [`Country`](https://datacommons.org/browser/Country), etc.), return a union of statistical variables available for the specified DCIDs. | ||
|
||
## General information about this endpoint | ||
|
||
**URL**: `/place/stat-vars/union` | ||
|
||
**Methods available**: `POST` | ||
|
||
**Required arguments**: | ||
|
||
* [`dcids`](/glossary.html): A list of `Place` nodes, identified by their DCIDs. | ||
|
||
## Example requests and responses | ||
|
||
### Example 1: Retrieve a list of the union of statistical variables available for the countries of Bolivia and Bhutan. | ||
|
||
<div> | ||
|
||
{% tabs log %} | ||
|
||
{% tab log GET Request %} | ||
|
||
This endpoint does not support GET requests. | ||
|
||
{% endtab %} | ||
|
||
{% tab log POST Request %} | ||
|
||
```bash | ||
curl --request POST \ | ||
--url https://api.datacommons.org/place/stat-vars/union \ | ||
--header 'content-type: application/json' \ | ||
--data '{ "dcids": ["country/BTN", "country/BOL"]}' | ||
``` | ||
|
||
{% endtab %} | ||
|
||
{% tab log javascript %} | ||
|
||
<iframe width="100%" height="300" src="//jsfiddle.net/datacommonsorg/tzowhea3/14/embedded/" allowfullscreen="allowfullscreen" allowpaymentrequest frameborder="0"></iframe> | ||
|
||
{% endtab %} | ||
|
||
{% endtabs %} | ||
|
||
</div> | ||
|
||
#### Response | ||
|
||
```json | ||
{ | ||
"statVars": { | ||
"statVars": [ | ||
"Amount_Consumption_Alcohol_15OrMoreYears_AsFractionOf_Count_Person_15OrMoreYears", | ||
"Amount_Consumption_Electricity_PerCapita", | ||
"Amount_Consumption_Energy_PerCapita", | ||
"Amount_Consumption_RenewableEnergy_AsFractionOf_Amount_Consumption_Energy", | ||
... | ||
] | ||
} | ||
} | ||
``` | ||
|
||
## Error Responses | ||
|
||
If your request is malformed in some way, you will receive a 400 status code and an error message like the following: | ||
|
||
```json | ||
{ | ||
"code": 3, | ||
"message": "Missing required arguments: dcid", | ||
"details": [ | ||
{ | ||
"@type": "type.googleapis.com/google.rpc.DebugInfo", | ||
"stackEntries": [], | ||
"detail": "internal" | ||
} | ||
] | ||
} | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shifucun it would be nice not to have to double-unroll "statVars" to get to the list. since this doc isn't published yet, perhaps we could update this before publishing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sent out a fix for this datacommonsorg/mixer#531