api_call.R 2.13 KB
Newer Older
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
1
library(hash)
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
2

Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
###############################################################
########################## i14y APIs ##########################
###############################################################

get_codelist <- function(
  identifier, 
  export_format="SDMX-ML", 
  version_format=2.1, 
  annotations=FALSE
  ) {
  api <- api_class(
    api_type = "codelist",
    export_format = export_format,
    parameters = glue("annotations={tolower(annotations)}"),
    id = identifier
  )
  api$get_response()
}
get_codelist(identifier='CL_NOGA_SECTION')



get_content_configuration <- function(){
  api <- api_class(api_type = "content_configuration")
  api$get_response()
}
get_content_configuration()
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
30
31


Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
32
33

get_identifier_content <- function(identifier){
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
34
  api <- api_class(
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
35
36
    api_type = "content_configuration_identifier",
    id = identifier
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
37
38
39
  )
  api$get_response()
}
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
40
41
42
get_identifier_content(identifier='HCL_CH_ISCO_19_PROF')


Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
43

Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
44
45
46
47
48
49
50
51
52
get_dataset_description <- function(identifier, language='fr'){
  api <- api_class(
    api_type = "dcat_dataset_description",
    id = identifier, 
    language = language
  )
  api$get_response()
}
get_dataset_description(identifier='HCL_NOGA', language='de')
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
53
54
55



Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
56
57
58
59
60
get_dataset_information <- function(identifier, language='en'){
  api <- api_class(
    api_type = "dcat_dataset_information",
    id = identifier, 
    language = language
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
61
  )
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
62
  api$get_response()
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
63
}
Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
get_dataset_information(identifier='HCL_NOGA', language='de')



get_data_structure <- function(identifier, language='en'){
  api <- api_class(
    api_type = "dcat_data_structure",
    id = identifier, 
    language = language
  )
  api$get_response()
}
get_data_structure(identifier='HCL_NOGA', language='it')



get_nomenclature_path_nodes <- function(identifier, path='.', filters='', language='en'){
  api <- api_class(
    api_type = "nomenclature_path_nodes",
    id = identifier, 
    path = path,
    parameters = stringify(filters),
    language = language
  )
  api$get_response()
}
my_filters <- hash(
  'prop1'= list("string"),
  'prop2' = list("string", "string2")
)
get_nomenclature_path_nodes(identifier='HCL_CH_ISCO_19_PROF', path='.', filters=my_filters)






Pauline Maury Laribière's avatar
Pauline Maury Laribière committed
101