Skip to content

Instantly share code, notes, and snippets.

@HanOostdijk
Last active October 1, 2018 11:58
Show Gist options
  • Save HanOostdijk/c6525a6ce199f5eef614cdaf563bf786 to your computer and use it in GitHub Desktop.
Save HanOostdijk/c6525a6ce199f5eef614cdaf563bf786 to your computer and use it in GitHub Desktop.
OData version 4 CBS beta Get Entity
start UPDATE 01OCT2018
according to Dennis Ramondt (CBS Open Data) this is how it should work.
end UPDATE 01OCT2018
Question about the `Get Entity` in OData version 4 CBS beta
If I want to retrieve the 23rd row of the Observations subtable of 900001NED, I can do this
in two ways. The data I get back is the same but the format is different. See res1 and res2 in last part of gist.
Questions:
- is this the intended behaviour? And if so, why different formats?
- is there a place where I can post questions of this kind without troubling all followers of the LinkedIn group
`Centraal Bureau voor de Statistiek; Open Data` ?
- is there documentation about OData version 4 apart from the terrible
`http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html` and friends?
> res1 = httr::GET("https://beta.opendata.cbs.nl/OData4/CBS-Maatwerk/900001NED/Observations?$skip=22&$top=1")
> jsonlite::prettify(httr::content(res1,as="text"))
{
"@odata.context": "https://beta.opendata.cbs.nl/OData4/CBS-Maatwerk/900001NED/$metadata#Observations",
"value": [
{
"Id": 23,
"Measure": "M00000001",
"ValueAttribute": "None",
"Value": 1040.0,
"PostCode6": "1011BW",
"Typegebruik": "A045558"
}
]
}
> res2 = httr::GET("https://beta.opendata.cbs.nl/OData4/CBS-Maatwerk/900001NED/Observations(23)")
> jsonlite::prettify(httr::content(res2,as="text"))
{
"@odata.context": "https://beta.opendata.cbs.nl/OData4/CBS-Maatwerk/900001NED/$metadata#Observations/$entity",
"Id": 23,
"Measure": "M00000001",
"ValueAttribute": "None",
"Value": 1040.0,
"PostCode6": "1011BW",
"Typegebruik": "A045558"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment