尝试使用HTTR(R编程)访问Indeed API

时间:2018-03-15 00:50:46

标签: r api login get httr

我是一名API新手试图访问Indeed.Com网站上的某个网页,使用它的API为我的雇主。我发送客户ID和秘密ID后无法接收令牌。任何帮助非常感谢。 Indeed API文档:http://opensource.indeedeng.io/api-documentation/docs/oauth/#before-you-start 确实是雇主API:https://employers.indeed.com/api/v1

 options("httr_oob_default" = T)
        options("httr_oauth_cache"= T)
        Sys.setenv("HTTR_SERVER_PORT" = "1410/")
        library(httr)

        library('httpuv')
        #Token Request URL
        request_url = 'https://secure.indeed.com/'
        #Token Access URL
        access_url = 'https://secure.indeed.com'
        #Authorization URL
        authorization_url = 'https://secure.indeed.com/account/oauth?client_id="Your client ID" &redirect_uri=http://localhost:1410/&response_type=code'
        #Saving client ID and Secret ID
        key <- 'YOUR CLIENT ID'
        secret <- 'CLIENT SECRET ID'
        #Sending OAUTH Request
        myinapp = oauth_app(NULL, key, secret)
        in_app = oauth_endpoint(request_url, authorization_url, access_url)
        #Getting Token
        token = oauth1.0_token(in_app, myinapp)
        #Authenticating Token
        mytoken = config(token = token)

0 个答案:

没有答案