-
Notifications
You must be signed in to change notification settings - Fork 2
/
api_example.R
19 lines (18 loc) · 930 Bytes
/
api_example.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#----------------
# Simple Example
#----------------
install.packages(c("devtools","rjson","httr"))
devtools::install_github("AndreasFischer1985/qqBaseX")
clientId="ee971dcb-96fa-47b3-b2be-00863e4fc88b"
clientSecret="1050e0b7-6db8-49e8-aff9-0e58e556681f"
postData=list( "grant_type"="client_credentials","client_id"=clientId,"client_secret"=clientSecret)
token_request=httr::POST(
url="https://rest.arbeitsagentur.de/oauth/gettoken_cc",
body=postData,encode="form",
config=httr::config(connecttimeout=60))
token=httr::content(token_request, as='parsed')$access_token
url="https://rest.arbeitsagentur.de/infosysbub/avgs/pc/v1/aktivierungsangebote?mz=SA%2001&uk=Bundesweit&deufoev=false&page=1"
data_request=httr::GET(url=url, httr::add_headers(.headers=c("OAuthAccessToken"=token)),
config=httr::config(connecttimeout=60))
data_request
data=rjson::fromJSON(rawToChar(httr::content(data_request)))