ropensci / patentsview

An R client to the PatentsView API
https://docs.ropensci.org/patentsview
Other
31 stars 9 forks source link

xheader_er_or_status(resp) : Gateway Timeout (HTTP 504) #33

Closed Someone894 closed 1 week ago

Someone894 commented 2 weeks ago

Hello,

currently I am trying to use the patentsview R-package to download some data, but I'm having trouble with the API. Here is a MWE which produces an Error in xheader_er_or_status(resp) : Gateway Timeout (HTTP 504):

data <- patentsview::search_pv(
  query = patentsview::qry_funs$contains(assignee_organization = "M System"),
  fields = c(
    "app_number",
    "app_country",
    "app_date",
    "assignee_country",
    "assignee_id",
    "assignee_organization",
    "cited_patent_number",
    "citedby_patent_number",
    "forprior_country",
    "forprior_date",
    "forprior_docnumber",
    "inventor_first_name",
    "inventor_last_name",
    "ipc_class"
  ),
  sort = c("app_date" = "asc"),
  endpoint = "patents",
  all_pages = TRUE
)

Is this the expected behaviour or a bug? How can I download the data if it the expected behaviour, is there some kind of batch mode? Can you fix the bug, if it is a bug?

mustberuss commented 2 weeks ago

This appears to be an API bug. A work-around would be to set mtchd_subent_only=FALSE in your search_pv call, the R package defaults it to TRUE.

Here's a browser call hitting the API directly that works and one that fails with a gateway timeout, the difference being their matched_subentities_only options parameter.

You could try reporting the bug to the API team but they're trying to sunset this version of the API. The R package is using the Legacy Endpoints . The new version of the API is not yet stable and does not have a matched_subentities_only option.

As a heads up, the new version of the API is quite different than the current one, requiring an API key and other breaking changes so when the R package is updated it will not be backward compatible.

Someone894 commented 1 week ago

@mustberuss Thenak you for the headsup and also the workaround. Its sems to me the best is to use the mtchd_subent_only=FALSE and wait for the new API to be relased. Im closing this issue now.