Some of the endpoints now return HATEOAS style links to get more data. E.g., the patent endpoint may return a link such as: "https://search.patentsview.org/api/v1/inventor/fl:th_ln:jefferson-1/"
retrieve_linked_data(
url,
encoded_url = FALSE,
api_key = Sys.getenv("PATENTSVIEW_API_KEY"),
...
)A link that was returned by the API on a previous call, an example in the documentation or a Request URL from the API's Swagger UI page.
boolean to indicate whether the url has been URL encoded, defaults to FALSE. Set to TRUE for Request URLs from Swagger UI.
API key, it defaults to Sys.getenv("PATENTSVIEW_API_KEY"). Request a key here.
Curl options passed along to httr2's req_options function.
A list with the following three elements:
A list with one element - a named data frame containing the data returned by the server. Each row in the data frame corresponds to a single value for the primary entity. For example, if you search the assignee endpoint, then the data frame will be on the assignee-level, where each row corresponds to a single assignee. Fields that are not on the assignee-level would be returned in list columns.
Entity counts across all pages of output (not just the page returned to you).
Details of the GET HTTP request that was sent to the server.
if (FALSE) {
retrieve_linked_data(
"https://search.patentsview.org/api/v1/cpc_group/G01S7:4811/"
)
endpoint_url <- "https://search.patentsview.org/api/v1/patent/"
q_param <- '?q={"_text_any":{"patent_title":"COBOL cotton gin"}}'
s_and_o_params <- '&s=[{"patent_id": "asc" }]&o={"size":50}'
f_param <- '&f=["inventors.inventor_name_last","patent_id","patent_date","patent_title"]'
# (URL broken up to avoid a long line warning in this Rd)
retrieve_linked_data(
paste0(endpoint_url, q_param, s_and_o_params, f_param)
)
retrieve_linked_data(
"https://search.patentsview.org/api/v1/patent/?q=%7B%22patent_date%22%3A%221976-01-06%22%7D",
encoded_url = TRUE
)
}