odataR_get_cat: Get catalog information

Description Usage Arguments Value Remarks Examples

View source: R/odataR_code.R

Description

This function can be used to get information from an OData catalog.

Usage

1
odataR_get_cat(root = NULL, type = "Tables", query = NULL, debug = F)

Arguments

root

Character string with root of structure. Default NULL i.e. determined by the last use of odataR_set_root and if never used 'https://opendata.cbs.nl'

type

Type of catalog information. This type can be one of:

  • NULL : a tibble with the various types in this catalog

  • 'Tables' or empty : a tibble with the Tables in this catalog

  • 'Featured' : a tibble with the Features in this catalog

  • 'Table_Featured' : a tibble with the Table_Featured in this catalog

  • 'Themes' : a tibble with the Themes in this catalog

  • 'Tables_Themes' : a tibble with the Tables_Themes in this catalog

query

OData query to restrict data returned from the catalog

debug

Boolean indicating if (for debugging) the generated OData queries are to be printed (default FALSE)

Value

A tibble (data_frame) when successful otherwise an empty tibble or a message

Remarks

See http://www.odata.org/documentation/odata-version-3-0/odata-version-3-0-core-protocol/ or http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html (depending on the version of the OData protocol that is used) for details about the query possibilities.

$format=json is forced by the code so do not specify $format=atom because this will not work

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
# all types in catalog:
df = odataR_get_cat(type=NULL)
# all Tables in catalog:
df = odataR_get_cat()
# all tables that have a Title starting with 'Vacature':
df = odataR_get_cat(query="?$filter=startswith(Title,'Vacature')")
# all tables that have a Title containing 'vacature' regardless of case:
df = odataR_get_cat(query="?$filter=substringof('vacature',tolower(Title))")
# all active tables that have a Title containing 'vacature' regardless of case:
df = odataR_get_cat(query="?$filter=substringof('vacature',tolower(Title)) and Frequency ne 'Stopgezet' ")
# all Featured entries in catalog:
df = odataR_get_cat(type='Featured')
# all Featured tables (?) in catalog:
df = odataR_get_cat(type='Table_Featured')
# all Themes in catalog:
df = odataR_get_cat(type='Themes')
# all Tables_Themes (?) in catalog:
df = odataR_get_cat(type='Tables_Themes')

## End(Not run)

HanOostdijk/odataR documentation built on May 14, 2020, 5:57 p.m.