cambialens / lens-api-doc

10 stars 5 forks source link

How to [get] information instead of [post] #50

Closed ZiliGit closed 2 years ago

ZiliGit commented 2 years ago

Hi,

I am a newcomer to the Lens API. The example to use the patent API in the API documentation is to [post] instead of [get]. I wonder how can I modify the following codes in python to [get] the correct information. What I need to include in the header if I do not use the "Bearer your-access-token" structure in the [post].

API example

Also, I would like to include the field like "include": ["reference_cited.patent.lens_id", "doc_key"], but when I tried this with the [post] request, it returns

image

But I am sure it is the correct field in the documentation.

Thanks for your help and time!

rosharma9 commented 2 years ago

You can use GET requests with two endpoints listed here:

  1. Just single record by Lens ID https://api.lens.org/patent/031-156-664-516-153?token=YOUR_TOKEN&include=biblio.references_cited.citations.patcit,lens_id

  2. Search for multiple records https://api.lens.org/patent/search?token= YOUR_TOKEN&size=10&query=YOUR_QUERY&include=biblio.references_cited.citations.patcit,lens_id&sort=asc(date_published)

We have two set of fields, one for searching and another for response. For include and exclude you will need to provide the response fields. Please let us know if you have further issues.

ZiliGit commented 2 years ago

Thanks for your prompt reply. I'll try that tomorrow and might have other problems.

Actually, I am confused about why the code example only provides [POST], which should be used only when someone wants to change the data, am I right? Also, I want to get patents' basic information as well as information on the cited patents under some broad class and need a relatively large number of patents. Is that possible for a free-trail account?

Thanks a lot.

rosharma9 commented 2 years ago

We have briefly mention it in API doc for scholarly and patent We will add a few code examples for GET. We considered POST for search to have preference over complex JSON based query. For large number of requests, please contact subscriptions@lens.org with your use case. Thank you

ZiliGit commented 2 years ago

Thanks for your clarification!

ZiliGit commented 2 years ago

Hi,

I have a follow-up question on the topic. If my query is to have patents in one specific category, and that one request may contain more than ten thousand patents. How can I use Pagination to satisfy the "10 API requests/minute and up to 100 records per request" restriction on my temporary account?

Thanks for your help!

rosharma9 commented 2 years ago

You can use our Cursor Based pagination. You can easily download 10K records with just 100 API calls with your temporary account (each request can access 100 records).
Here is a python code example explaining how it works. Thank you