Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DSCC
FSO Metadata Auto R
Commits
1c6c0a19
Commit
1c6c0a19
authored
Oct 20, 2021
by
Pauline Maury Laribière
Browse files
hash format output
parent
3dec8494
Pipeline
#268920
passed with stage
in 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
api_call.R
View file @
1c6c0a19
library
(
httr
)
library
(
jsonlite
)
res
<-
GET
(
"https://www.i14y.admin.ch/api/ContentConfigurations"
)
json
<-
fromJSON
(
rawToChar
(
res
$
content
))
names
(
json
)
json
$
identifier
res
<-
GET
(
"https://www.i14y.admin.ch/api/ContentConfigurations/HCL_CH_ISCO_19_PROF"
)
cc
<-
fromJSON
(
rawToChar
(
res
$
content
))
res
<-
GET
(
"https://www.i14y.admin.ch/api/Nomenclatures/Childnodes/HCL_CH_ISCO_19_PROF/fr/.?additionalProp1=string"
)
ncn
<-
fromJSON
(
rawToChar
(
res
$
content
))
data1
<-
read.csv
(
"https://www.i14y.admin.ch/api/Nomenclatures/HCL_CH_ISCO_19_PROF/levelexport/CSV?level=1&annotations=true&additionalProp2=string&language=fr"
)
data2
<-
read.csv
(
"https://www.i14y.admin.ch/api/Nomenclatures/HCL_CH_ISCO_19_PROF/multiplelevels/CSV?language=fr&levelFrom=1&levelTo=4&annotations=true&additionalProp1=string"
)
format_request.R
0 → 100644
View file @
1c6c0a19
library
(
httr
)
library
(
jsonlite
)
library
(
rsdmx
)
library
(
hash
)
sdmx_request
<-
function
(
url
)
{
as.data.frame
(
readSDMX
(
myUrl
))
}
json_request
<-
function
(
url
)
{
fromJSON
(
rawToChar
(
GET
(
url
)
$
content
))
}
csv_request
<-
function
(
url
)
{
read.csv
(
url
)
}
REQUEST_FUNCTION_MAPPING
<-
hash
(
"sdmx"
=
sdmx_request
,
"json"
=
json_request
,
"csv"
=
csv_request
)
json
<-
fromJSON
(
rawToChar
(
GET
(
"https://www.i14y.admin.ch/api/ContentConfigurations"
)
$
content
))
names
(
json
)
json
$
identifier
res
<-
GET
(
"https://www.i14y.admin.ch/api/ContentConfigurations/HCL_CH_ISCO_19_PROF"
)
cc
<-
fromJSON
(
rawToChar
(
res
$
content
))
res
<-
GET
(
"https://www.i14y.admin.ch/api/Nomenclatures/Childnodes/HCL_CH_ISCO_19_PROF/fr/.?additionalProp1=string"
)
ncn
<-
fromJSON
(
rawToChar
(
res
$
content
))
data1
<-
read.csv
(
"https://www.i14y.admin.ch/api/Nomenclatures/HCL_CH_ISCO_19_PROF/levelexport/CSV?level=1&annotations=true&additionalProp2=string&language=fr"
)
h
[[
'csv'
]](
"https://www.i14y.admin.ch/api/Nomenclatures/HCL_CH_ISCO_19_PROF/levelexport/CSV?level=1&annotations=true&additionalProp2=string&language=fr"
)
data2
<-
read.csv
(
"https://www.i14y.admin.ch/api/Nomenclatures/HCL_CH_ISCO_19_PROF/multiplelevels/CSV?language=fr&levelFrom=1&levelTo=4&annotations=true&additionalProp1=string"
)
myUrl
<-
"https://www.i14y.admin.ch/api/CodeLists/CL_NOGA_SECTION/exports/SDMX-ML/2.1?annotations=true"
dataset
<-
as.data.frame
(
readSDMX
(
myUrl
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment