Home > database >  How do I connect to the free cyren.com - API with R?
How do I connect to the free cyren.com - API with R?

Time:11-28

I want to connect to the Cyren API via R. Link

But I can't make it work.Does anyone maybe have some experience with it?

Here is a reproducable code:

library(httr)
a <- POST(url = "https://api-url.cyren.com/api/v1/free/url",
          body='"data":[{"url":"test.com"}]',
          encode = 'json',
          config = list(add_headers(Authorization ='Bearer my.JWT.token',
                                    'Content-Type' = 'application/json')
          )
)

a

Expected output: {"url":"test.com","categoryNames": ["Computers & Technology"]}

But I always get the Status 401 (unautorized).

CodePudding user response:

I figured it out.

a <- POST(url = "https://api-url.cyren.com/api/v1/free/url",
      body='{"url":"cyren.com"}',
      encode = 'json',
      config = add_headers(Authorization= 'Bearer my.JWT.token'
                                ,'Content-Type' = 'application/json'
      )

)

  • Related