Skip to main content
 
 
 
IN THIS SECTION
3 posts
lucy wang
Last seen: 08/09/2021 - 09:45
Joined: 03/10/2021 - 11:11
API query using Post method

I am a novice to the patent data, and I tried to write a request post python command to query the data by referencing https://www.patentsview.org/api/patent.html

 

url = 'https://www.patentsview.org/api/patents/query'
r = requests.post(url,  json = {"q":{"_gte":{"patent_date":"2007-01-04"}},"f":["patent_number","patent_date"]} )

I then got An HTTP status code of 400, and with the r.text returns '{"status":"error","payload":{"error":"\'q\' param is missing","code":"RQ1"}}'

Any advice for how to fix this issue? Thanks!

Russ
Last seen: 12/05/2024 - 10:08
Joined: 11/14/2017 - 22:15
NEW URLS

Hi Lucy,

The api recently moved their endpoints to https://api.patentsview.org/ and removed api/ from the path.  The documentation might be lagging.  The old urls are supposed to return a permanent redirect (301) with a new url so I would think your query should have worked.  Adjusting the url seem to fix your problem.

import requests
url = 'https://api.patentsview.org/patents/query'
r = requests.post(url,  json = {"q":{"_gte":{"patent_date":"2007-01-04"}},"f":["patent_number","patent_date"]} )

Russ
 

lucy wang
Last seen: 08/09/2021 - 09:45
Joined: 03/10/2021 - 11:11
THAT WORKS, THANKS VERY MUCH…

That works, thanks very much!

Best,

Lucy