edwindj / cbsodataR

Statistics Netherlands (CBS) OpenData API Client for R
https://edwindj.github.io/cbsodataR
32 stars 12 forks source link

`cbs_get_data` with `base_url="http://dataderden.cbs.nl` fails #29

Closed edwindj closed 3 years ago

edwindj commented 3 years ago

cbs_get_data fails, trying to connect to http://opendata.cbs.nl. Fixed in version 0.5.2.

Remedies for now:

Thanks to Mirjam Zengers for reporting

edwindj commented 3 years ago

This generates an error:

library(cbsodataR)
d <- cbs_get_data("24011NED", base_url = "http://dataderden.cbs.nl")
## cannot open URL 'https://opendata.cbs.nl/ODataApi/odata/24011NED': HTTP status was '404 Not Found'Failing: http://opendata.cbs.nl/ODataApi/odata/24011NED
## Retrying...cannot open URL 'https://opendata.cbs.nl/ODataApi/odata/24011NED': HTTP status was '404 Not Found'Error in open.connection(con, "rb") : 
## cannot open the connection to 'http://opendata.cbs.nl/ODataApi/odata/24011NED'

Current fixes:

a)

d <- cbs_get_data("24011NED", catalog="AZW")
# catalog can be found with 
catalogs <- cbs_get_catalogs()
# or 
datasets <- cbs_get_datasets(catalog=NULL) # setting to NULL, shows tables from all catalogs.

b)

d <- cbs_get_data("24011NED", base_url = "http://dataderden.cbs.nl", show_progress=FALSE)

c)

d <- cbs_get_data("24011NED", base_url = "http://dataderden.cbs.nl", verbose=TRUE)

## Retrieving data from table '24011NED'

## http://dataderden.cbs.nl/ODataFeed/odata/24011NED/TypedDataSet?$format=json

## 
## Reading...

## https://dataderden.cbs.nl/ODataFeed/odata/24011NED/TypedDataSet?$format=json&$skip=10000

## 
## Writing...

## 
## Done!
edwindj commented 3 years ago

Fixed in 0.5.2 (github version). Will close it, when on CRAN