OHDSI / ROhdsiWebApi

An R package for interfacing with a WebAPI instance
https://ohdsi.github.io/ROhdsiWebApi
10 stars 17 forks source link

Error when the webapi baseUrl has a trailing slash in `exportCohortDefinitionSet` #250

Open MaximMoinat opened 2 years ago

MaximMoinat commented 2 years ago

The following gives a http error 404 ‘Resource not found’: exportCohortDefinitionSet(baseUrl = 'http://localhost:8080/WebAPI/', cohortIds = cohortIds)

After a lot of searching on the OHDSI forums, I found that this caused by the trailing slash in the given WebApi URL (i.e. baseUrl = 'http://localhost:8080/WebAPI' does work). This is very hard to figure out as the error message is very generic. Also, the method documentation does not explicitly say that the url should be given without a slash.

It would be great if this case can be better handled. I see two options:

MaximMoinat commented 2 years ago

Footnote: Atlas->Configuration gives the WebAPI with a trailing slash. This is probably where many people find their WebAPI url, so many will add the trailing slash. image

MaximMoinat commented 2 years ago

There is already a '.checkBaseUrl' function that does exactly this. However, this is not called in the exportCohortDefinitonSet function