bergant / rapiclient

Dynamic Open API (Swagger) Client for R
Other
66 stars 18 forks source link

SEEK platform #3

Closed jcolomb closed 1 month ago

jcolomb commented 5 years ago

tried the package with the SEEK platform, and it is not working

get_api("https://www.fairdomhub.org")

Error in parse_con(txt, bigint_as_char) : lexical error: invalid char in json text. <!doctype html> <html lang="en (right here) ------^

I am not sure on which side the error is, but they say they use openapi ...

adamsardar commented 5 years ago

The get_api routine requires a link to the API spec at "https://docs.seek4science.org/tech/api/definitions/swaggerSeek-oas3.yml"

However, this spec is a yaml file rather than JSON, so you need to do a quick conversion:

library(rapiclient) library(yaml) library(jsonlite) library(magrittr)

APIspec_yaml <- readLines("https://docs.seek4science.org/tech/api/definitions/swaggerSeek-oas3.yml")

FAIRDOM_SEEK <- read_yaml(text = APIspec_yaml) %>% toJSON() %>% get_api()

In order to create a functioning client, I suspect that you'll need to add basic authentication in to your HTTP header.

SEEKops <- get_operations(FAIRDOM_SEEK, .headers = authenticationHeader )

LiNk-NY commented 1 month ago

The API should handle both JSON and YML API files. This issue should be resolved. Feel free to open if you have further issues.