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

Add POST requests for examples and fix URL-encoding content #513

Merged
merged 129 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 126 commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
6af1ba7
integrate custom docs with new UI
kmoscoe Jul 11, 2024
cd0fe76
more edits
kmoscoe Jul 11, 2024
c45d61b
use website wording for intro
kmoscoe Jul 15, 2024
f5cbbca
fix numbering in table
kmoscoe Jul 15, 2024
90c57e7
Merge branch 'master' into custom_dc
kmoscoe Jul 15, 2024
57ca62f
rename and some edits
kmoscoe Jul 15, 2024
2277cb1
Merge branch 'custom_dc' of https://github.com/kmoscoe/docsite into c…
kmoscoe Jul 15, 2024
fb33722
rename manage_repo file, per Bo
kmoscoe Jul 16, 2024
0ebdd67
Merge.
kmoscoe Jul 17, 2024
e3148c4
merge
kmoscoe Jul 17, 2024
ee5f580
Merge branch 'datacommonsorg:master' into master
kmoscoe Jul 22, 2024
5993fb7
Merge branch 'master' of https://github.com/datacommonsorg/docsite
kmoscoe Jul 22, 2024
61ce06d
Merge branch 'custom_dc'
kmoscoe Jul 22, 2024
2b37137
Merge branch 'datacommonsorg:master' into master
kmoscoe Jul 22, 2024
37f3e87
formatting edits
kmoscoe Jul 23, 2024
d83db88
updates per Keyur's feedback
kmoscoe Jul 24, 2024
03b906f
Fix typos
kmoscoe Jul 24, 2024
03538af
fix nav order
kmoscoe Jul 24, 2024
d7fb58f
fix link to API key request form
kmoscoe Jul 24, 2024
c746a7e
update form link
kmoscoe Jul 24, 2024
d5e04af
update key request form and output dir env var
kmoscoe Jul 24, 2024
0183130
Merge branch 'master' into custom_dc
kmoscoe Jul 25, 2024
b6f53cf
Revert to gerund
kmoscoe Jul 26, 2024
e538860
Merge branch 'master' into master
kmoscoe Jul 26, 2024
d368ba4
new troubleshooting entry
kmoscoe Jul 31, 2024
db99da0
Merge branch 'datacommonsorg:master' into master
kmoscoe Jul 31, 2024
535962c
Merge branch 'custom_dc' of https://github.com/kmoscoe/docsite into c…
kmoscoe Jul 31, 2024
fd071e9
Merge branch 'master' of https://github.com/kmoscoe/docsite into cust…
kmoscoe Jul 31, 2024
771ccca
fix typo
kmoscoe Jul 31, 2024
7f2bccf
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 1, 2024
7286ff2
Merge branch 'master' of https://github.com/kmoscoe/docsite into cust…
kmoscoe Aug 5, 2024
6e61dac
new data container procedures
kmoscoe Aug 5, 2024
24ea3c4
more work
kmoscoe Aug 5, 2024
03b9786
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 6, 2024
534461b
Merge branch 'master' of https://github.com/kmoscoe/docsite into cust…
kmoscoe Aug 6, 2024
d4d81c8
more work
kmoscoe Aug 6, 2024
5d52e4b
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 6, 2024
8054ac7
Merge branch 'master' of https://github.com/kmoscoe/docsite into cust…
kmoscoe Aug 6, 2024
166e7e1
complete data draft
kmoscoe Aug 6, 2024
079fe62
more changes
kmoscoe Aug 7, 2024
5ccaba5
more changes
kmoscoe Aug 8, 2024
6d80bcc
more revisions
kmoscoe Aug 8, 2024
21917fa
update troubleshooting doc etc.
kmoscoe Aug 9, 2024
586973a
new version of diagrams
kmoscoe Aug 12, 2024
c207f6b
remove data loading problems troubleshooting entry; can't reproduce
kmoscoe Aug 12, 2024
6fa91d3
revert title change
kmoscoe Aug 12, 2024
9cde771
add example for not mixing entity types
kmoscoe Aug 12, 2024
83bbaf2
changes from Keyur
kmoscoe Aug 12, 2024
86800ba
add screenshots for GCP, and related changes
kmoscoe Aug 13, 2024
1a23559
fixed one image
kmoscoe Aug 13, 2024
b4e6bd4
added screenshots for Cloud Run service
kmoscoe Aug 13, 2024
a68f8b4
resize images
kmoscoe Aug 13, 2024
05b1894
more changes from Keyur
kmoscoe Aug 13, 2024
c606037
fix a tiny error
kmoscoe Aug 13, 2024
9bb0355
delete unused images
kmoscoe Aug 13, 2024
c497e03
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 13, 2024
914bc76
Merge branch 'datacommonsorg:master' into custom_dc
kmoscoe Aug 13, 2024
75e9b41
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 13, 2024
edcb5bc
fix missing dash
kmoscoe Aug 13, 2024
e8ca73e
update services container name
kmoscoe Aug 14, 2024
cab4484
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 14, 2024
529b734
Merge branch 'master' into custom_dc
kmoscoe Aug 14, 2024
740a1e6
Merge branch 'custom_dc' of https://github.com/kmoscoe/docsite into c…
kmoscoe Aug 14, 2024
9bf96d7
Merge branch 'master' of https://github.com/kmoscoe/docsite into cust…
kmoscoe Aug 14, 2024
ae46ea2
update build file
kmoscoe Aug 14, 2024
4ce0fb9
adjust build command
kmoscoe Aug 14, 2024
68a3f51
Revert "adjust build command"
kmoscoe Aug 14, 2024
d8f1ab7
update docker file
kmoscoe Aug 14, 2024
d67d280
more fixes
kmoscoe Aug 14, 2024
15a0a18
one last fix
kmoscoe Aug 14, 2024
5547194
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 15, 2024
0f3a1df
Merge branch 'datacommonsorg:master' into custom_dc
kmoscoe Aug 15, 2024
8c79911
merge
kmoscoe Aug 15, 2024
437948c
make links to Cloud Console open in a new page
kmoscoe Aug 15, 2024
f225640
Merge branch 'custom_dc' of https://github.com/kmoscoe/docsite into c…
kmoscoe Aug 15, 2024
1b3fcdf
fixes to quickstart suggested by Prem
kmoscoe Aug 16, 2024
4677644
one more change
kmoscoe Aug 16, 2024
ac3ceec
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 16, 2024
ce66faf
Merge branch 'datacommonsorg:master' into custom_dc
kmoscoe Aug 16, 2024
8b34a52
Merge branch 'master' of https://github.com/kmoscoe/docsite into cust…
kmoscoe Aug 16, 2024
27f8528
Merge branch 'master' into custom_dc
kmoscoe Aug 21, 2024
cba3fe9
change from Keyur
kmoscoe Aug 21, 2024
53106b9
Merge branch 'custom_dc' of https://github.com/kmoscoe/docsite into c…
kmoscoe Aug 21, 2024
5e68a9f
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 26, 2024
17eb420
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 26, 2024
cf820e0
Merge branch 'master' of https://github.com/kmoscoe/docsite into cust…
kmoscoe Aug 26, 2024
41aacce
revise procedure
kmoscoe Aug 26, 2024
1cfe86c
Merge branch 'master' into custom_dc
kmoscoe Aug 27, 2024
e204fbd
merge
kmoscoe Aug 27, 2024
8b78d9f
merge
kmoscoe Aug 27, 2024
c85c376
add brief explanation of data model to quickstart
kmoscoe Aug 28, 2024
df1a8dd
Merge branch 'datacommonsorg:master' into master
kmoscoe Aug 28, 2024
922a139
Merge branch 'master' of https://github.com/kmoscoe/docsite into cust…
kmoscoe Aug 28, 2024
39f3309
Merge branch 'custom_dc' of https://github.com/kmoscoe/docsite into c…
kmoscoe Aug 28, 2024
5de4350
slight wording tweak
kmoscoe Aug 28, 2024
d82a728
incorporate feedback from Keyur
kmoscoe Aug 29, 2024
7f7903e
remove erroneous edit
kmoscoe Aug 29, 2024
fcaa5c5
correct missing text
kmoscoe Aug 29, 2024
c752d06
more work on tasks for finding stuff
kmoscoe Aug 29, 2024
0fcf34c
Merge branch 'master' of https://github.com/datacommonsorg/docsite
kmoscoe Sep 3, 2024
1f6c492
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 3, 2024
dee1e6a
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 4, 2024
8bc313f
Merge branch 'master' of https://github.com/datacommonsorg/docsite
kmoscoe Sep 4, 2024
0678683
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 4, 2024
91616c4
Merge branch 'master' of https://github.com/datacommonsorg/docsite
kmoscoe Sep 4, 2024
c322763
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 4, 2024
627fb89
Merge branch 'master' of https://github.com/datacommonsorg/docsite
kmoscoe Sep 4, 2024
6d8c42d
Merge branch 'master' of https://github.com/datacommonsorg/docsite
kmoscoe Sep 9, 2024
cc6d9e3
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 10, 2024
e588231
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 10, 2024
837a782
Merge branch 'master' of https://github.com/kmoscoe/docsite
kmoscoe Sep 10, 2024
bde4843
merge
kmoscoe Sep 10, 2024
0da5d90
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 11, 2024
d8a639c
Merge branch 'master' of https://github.com/kmoscoe/docsite into cust…
kmoscoe Sep 11, 2024
b95565d
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 13, 2024
50e490a
Merge branch 'master' of https://github.com/kmoscoe/docsite into cust…
kmoscoe Sep 13, 2024
7f1b9d1
update to use env.sample
kmoscoe Sep 13, 2024
5137208
typo
kmoscoe Sep 13, 2024
081f883
typo
kmoscoe Sep 13, 2024
47daec0
Merge branch 'custom_dc' of https://github.com/kmoscoe/docsite into c…
kmoscoe Sep 13, 2024
7c24813
get file back in head shape
kmoscoe Sep 13, 2024
89c04d6
fix file name
kmoscoe Sep 13, 2024
14a22e4
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 16, 2024
a2d42cf
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 16, 2024
96c7a34
Merge branch 'master' of https://github.com/kmoscoe/docsite into api
kmoscoe Sep 16, 2024
4d36b05
add POST requests
kmoscoe Sep 17, 2024
b0873ea
Merge branch 'datacommonsorg:master' into master
kmoscoe Sep 18, 2024
4f21783
Merge branch 'master' of https://github.com/kmoscoe/docsite into api
kmoscoe Sep 18, 2024
ae4b0ee
fixes from Jennifer
kmoscoe Sep 18, 2024
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
2 changes: 1 addition & 1 deletion api/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
title: API
nav_order: 0
nav_order: 4
has_children: true
---

Expand Down
33 changes: 25 additions & 8 deletions api/rest/v2/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
title: REST (V2)
nav_order: 10
nav_order: 5
parent: API
has_children: true
published: true
Expand Down Expand Up @@ -200,9 +200,25 @@ To illustrate again using the Argentina example:
- All cities directly contained in Argentina (dcid: `country/ARG`): `country/ARG<-containedInPlace{typeOf:City}`
- All cities indirectly contained in Argentina (dcid: `country/ARG`): `country/ARG<-containedInPlace+{typeOf:City}`

## Escape codes for reserved characters in GET requests
{: #url-encode}
## URL-encoding reserved characters in GET requests

HTTP GET requests do not allow some of the characters used by Data Commons DCIDs and relation expressions. When sending GET requests, you may need use the [corresponding percent codes](https://en.wikipedia.org/wiki/Percent-encoding){: target="_blank"} for reserved characters.
HTTP GET requests do not allow some of the characters used by Data Commons DCIDs and relation expressions. When sending GET requests, you may need use the [corresponding percent codes](https://en.wikipedia.org/wiki/Percent-encoding){: target="_blank"} for reserved characters. For example, a query string such as the following:
kmoscoe marked this conversation as resolved.
Show resolved Hide resolved

```
https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=geoId/06&property=<-*
```
should be encoded as:

```
https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=geoId%2F06&property=%3C-%
kmoscoe marked this conversation as resolved.
Show resolved Hide resolved
```

Although sometimes the original characters may work, it's safest to always encode them.

> **Tip:** Don't URL-encode delimiters between parameters (`&`), separators between parameter names and values (`=`), or `-`.

See [https://www.w3schools.com/tags/ref_urlencode.ASP](https://www.w3schools.com/tags/ref_urlencode.ASP){: target="_blank"} for a handy reference.

{: #pagination}
## Pagination
Expand All @@ -216,7 +232,7 @@ For example, the request:

```bash
curl --request GET \
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=geoId/06&property=<-*'
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=geoId%2F06&property=%3C-%'
kmoscoe marked this conversation as resolved.
Show resolved Hide resolved
```

will return something like:
Expand All @@ -228,15 +244,15 @@ will return something like:
"arcs": < ... output truncated for brevity ...>
},
},
"nextToken": "SoME_veRy_L0ng_S+rIng"
"nextToken": "SoME_veRy_L0ng_STrIng"
}
```

To get the next set of entries, repeat the previous command and append the `nextToken`:

```bash
curl --request GET \
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=geoId/06&property=<-*&nextToken=SoME_veRy_L0ng_S+rIng'
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=geoId%2F06&property=%3C-%&nextToken=SoME_veRy_L0ng_STrIng'
kmoscoe marked this conversation as resolved.
Show resolved Hide resolved
```

Similarly for POST requests, this would look like:
Expand All @@ -248,6 +264,7 @@ curl -X POST \
--data '{
"nodes": "geoId/06",
"property": "<-*",
"nextToken": "SoME_veRy_L0ng_S+rIng"
"nextToken": "SoME_veRy_L0ng_STrIng"
}'
```
```
Don't forget to URL-encode any special characters that appear in the string.
58 changes: 46 additions & 12 deletions api/rest/v2/node.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
title: Get node properties
nav_order: 3
nav_order: 7
parent: REST (V2)
grand_parent: API
published: true
Expand Down Expand Up @@ -104,9 +104,9 @@ The response looks like:

## Examples

### Example 1: Get all incoming arcs for a given node
### Example 1: Get all incoming arc labels for a given node

Get all incoming arcs of the node with DCID `geoId/06` by querying all properties with the `<-` symbol. This returns just the property labels.
Get all incoming arc property labels of the node with DCID `geoId/06` by querying all properties with the `<-` symbol. This returns just the property labels but not the property values.

Parameters:
{: .example-box-title}
Expand All @@ -116,12 +116,21 @@ nodes: "geoId/06"
property: "<-"
```

Request:
GET Request:
{: .example-box-title}

```bash
curl --request GET --url \
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=geoId/06&property=<-'
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=geoId%2F06&property=%3C-'
```

POST Request:
{: .example-box-title}

```bash
curl -X POST -H "X-API-Key: AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI" \
https://api.datacommons.org/v2/node \
-d '{"nodes": ["geoId/06"], "property": "<-"}'
```

Response:
Expand All @@ -142,7 +151,6 @@ Response:
}
}
```
{: .example-box-content .scroll}

### Example 2: Get one property for a given node

Expand All @@ -156,12 +164,21 @@ nodes: "dc/03lw9rhpendw5"
property: "->name"
```

Request:
GET Request:
{: .example-box-title}

```bash
curl --request GET --url \
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=dc/03lw9rhpendw5&property=->name'
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=dc%2F03lw9rhpendw5&property=-%3Ename'
```

POST Request:
{: .example-box-title}

```bash
curl -X POST -H "X-API-Key: AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI" \
https://api.datacommons.org/v2/node \
-d '{"nodes": ["dc/03lw9rhpendw5"], "property": "->name"}'
```

Response:
Expand All @@ -187,7 +204,6 @@ Response:
```
{: .example-box-content .scroll}


{: #multiple-properties}
### Example 3: Get multiple property values for multiple nodes

Expand All @@ -203,7 +219,16 @@ nodes: "geoId/06085", "geoId/06087"
property: "->[name, latitude, longitude]"
```

Request:
GET Request:
{: .example-box-title}

```bash
curl --request GET --url \
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=geoId%2F06085&nodes=geoId%2F06087&property=-%3E%5Bname,%20latitude,%20longitude%5D'

```

POST Request:
{: .example-box-title}

```bash
Expand Down Expand Up @@ -310,12 +335,21 @@ nodes: "PowerPlant"
property: "<-*"
```

Request:
GET Request:
{: .example-box-title}

```bash
curl --request GET --url \
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=PowerPlant&property=<-*'
'https://api.datacommons.org/v2/node?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&nodes=PowerPlant&property=%3C-%2A'
```

POST Request:
{: .example-box-title}

```bash
curl -X POST -H "X-API-Key: AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI" \
https://api.datacommons.org/v2/node \
-d '{"nodes": ["PowerPlant"], "property": "<-*"}'
```

Response:
Expand Down
65 changes: 43 additions & 22 deletions api/rest/v2/observation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
title: Get statistical observations
nav_order: 1
nav_order: 6
parent: REST (V2)
grand_parent: API
published: true
Expand Down Expand Up @@ -38,20 +38,22 @@ X-API-Key: AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI
JSON data:
{
"date": "<var>DATE_EXPRESSION</var>",
"variable.dcids": [
"variable": {
"dcids": [
"<var>VARIABLE_DCID_1</var>",
"<var>VARIABLE_DCID_2</var>",
...
],
"entity.dcids": [
]
},
"entity": {
"dcids":[
"<var>ENTITY_DCID_1</var>",
"<var>ENTITY_DCID_2</var>",
...
],
"entity.expression": <var>ENTITY_EXPRESSION</var>,
"select": "variable",
"select": "entity",
...
]
"expression": "<var>ENTITY_EXPRESSION</var>"
},
"select": ["date", "entity", "variable", "value"]
}
</div>

Expand Down Expand Up @@ -174,9 +176,6 @@ With `select=date` and `select=value` specified, the response looks like:

Specify `date=LATEST` to get the latest observations and values. In this example, we select the entity by its DCID using `entity.dcids`.

> Note: When sending a GET request, you need to use the following percent codes for reserved characters:
- `%2F` for `/`

Parameters:
{: .example-box-title}

Expand All @@ -190,13 +189,22 @@ select: "value"
select: "date"
```

Request:
GET Request:
{: .example-box-title}

```bash
curl --request GET --url \
'https://api.datacommons.org/v2/observation?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&date=LATEST&variable.dcids=Count_Person&entity.dcids=country%2FUSA&select=entity&select=variable&select=value&select=date'
```
POST Request:
{: .example-box-title}

```bash
curl -X POST -H "X-API-Key: AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI" \
https://api.datacommons.org/v2/observation \
-d '{"date": "LATEST", "variable": { "dcids": ["Count_Person"] }, "entity": { "dcids": ["country/USA"] }, "select": ["entity", "variable", "value", "date"] }'
```

{: .example-box-content .scroll}

Response:
Expand Down Expand Up @@ -279,13 +287,23 @@ select: "value"
select: "variable"
```

Request:
GET Request:
{: .example-box-title}

```bash
curl --request GET --url \
'https://api.datacommons.org/v2/observation?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&date=2015&variable.dcids=Count_Person&entity.dcids=country%2FUSA&entity.dcids=geoId%2F06&select=date&select=entity&select=value&select=variable'
```

POST Request:
{: .example-box-title}

```bash
curl -X POST -H "X-API-Key: AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI" \
https://api.datacommons.org/v2/observation \
-d '{"date": "2015", "variable": { "dcids": ["Count_Person"] }, "entity": { "dcids": ["country/USA", "geoId/06"] }, "select": ["entity", "variable", "value", "date"] }'
```

{: .example-box-content .scroll}

Response:
Expand Down Expand Up @@ -355,13 +373,6 @@ with date and value for each variable
([`Count_Person`](https://datacommons.org/tools/statvar#sv=Count_Person){: target="_blank"}) and
entity (all counties in California).

> Note: When sending a GET request, you need to use the following escape codes for reserved characters:
- `%3C` for `<`
- `%2B` for `+`
- `%7B` for `{`
- `%3A` for `:`
- `%7D` for `}`

Parameters:
{: .example-box-title}

Expand All @@ -375,13 +386,23 @@ select: "value"
select: "variable"
```

Request:
GET Request:
{: .example-box-title}

```bash
curl --request GET --url \
'https://api.datacommons.org/v2/observation?key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI&date=2015&date=LATEST&variable.dcids=Count_Person&entity.expression=geoId%2F06%3C-containedInPlace%2B%7BtypeOf%3ACounty%7D&select=date&select=entity&select=value&select=variable'
```

POST Request:
{: .example-box-title}

```bash
curl -X POST -H "X-API-Key: AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI" \
https://api.datacommons.org/v2/observation \
-d '{"date": "LATEST", "variable": { "dcids": ["Count_Person"] }, "entity": { "expression": "geoId/06<-containedInPlace+{typeOf:County}"}, "select": ["entity", "variable", "value", "date"] }'
```

{: .example-box-content .scroll}

Response:
Expand Down
Loading