Issue
I want to use a Python requests.post() to get data from the US Patent & Trademark Office via an API. The details of the API appear href="https://developer.uspto.gov/ds-api-docs/index.html?url=https%3A//developer.uspto.gov/ds-api/swagger/docs/enriched_cited_reference_metadata.json/v2" rel="nofollow noreferrer">here.
That page also contains a widget you can use to try out the API. Putting in an appropriate entry for the criteria field, it generates the corresponding API with a curl statement, e.g.
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'criteria=patentApplicationNumber%3A%20%2215931761%22&start=0&rows=100' 'https://developer.uspto.gov/ds-api/enriched_cited_reference_metadata/v2/records'
I tried using the curl-to-Python converter here, which produced the following:
import requests
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
}
data = {
'criteria': 'patentApplicationNumber: "15931761"',
'start': '0',
'rows': '100',
}
response = requests.post(
'https://developer.uspto.gov/ds-api/enriched_cited_reference_metadata/v2/records',
headers=headers,
data=data,
)
Unfortunately, that generates an error with a very long Traceback. I haven't included it here because I don't think it is helpful, but I can add it if necessary.
I would appreciate any guidance as to how to correct the syntax of the requests.post() to get the API to recognize it.
Solution
Your code seems correct, but add verify=False
(or better, supply the correct certificate) to connect to the server:
import requests
url = 'https://developer.uspto.gov/ds-api/enriched_cited_reference_metadata/v2/records'
data = {
'criteria': 'patentApplicationNumber: "15931761"',
'start': 0,
'rows': 100
}
out = requests.post(url, data=data, verify=False).json()
print(out)
Prints:
{
"responseHeader": {
"zkConnected": True,
"status": 0,
"QTime": 0,
"params": {
"json": '{"params":{"q":"patentApplicationNumber: \\"15931761\\"","start":0,"rows":100,"fl":"applicantCitedExaminerReferenceIndicator,citationCategoryCode,citedDocumentIdentifier,createDateTime,createUserIdentifier,examinerCitedReferenceIndicator,groupArtUnitNumber,id,inventorNameText,obsoleteDocumentIdentifier,officeActionCategory,officeActionDate,passageLocationText,patentApplicationNumber,qualitySummaryText,relatedClaimNumberText,techCenter,workGroup","wt":"json","indent":"on"}}'
},
},
"response": {
"numFound": 14,
"start": 0,
"docs": [
{
"id": "5829161452615b32ddde83914a441f63",
"applicantCitedExaminerReferenceIndicator": True,
"citationCategoryCode": "Y",
"citedDocumentIdentifier": "US 20120223801 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": False,
"inventorNameText": "Moon",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"passageLocationText": ["par. 0009 | par. 0069 | F.2d"],
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"relatedClaimNumberText": "4",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "0923fddf0c2df361530dd7e7be8e3913",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "A",
"citedDocumentIdentifier": "US 20140306795 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "Kato; Motofumi",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "25e7a8360176ddd95177ebe424a89e62",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "A",
"citedDocumentIdentifier": "US 20100173509 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "HOLBROOK; MEGHAN ANN",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "1f5f19101b555590604eba29f26a2625",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "Y",
"citedDocumentIdentifier": "US 20080191832 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "Tsai; Chon-Ming",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"passageLocationText": [
"Fig. 4-5 | par. 0043 | par. 0045-0048 | F.2d | claim 3 | claim 5 | claim 1 | claim 7 | par. 0046 | claim 2 | claim 4 | claim 6"
],
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"relatedClaimNumberText": "1-7",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "671da6feb6a77837bcfbd50ae3b72dba",
"applicantCitedExaminerReferenceIndicator": True,
"citationCategoryCode": "Y",
"citedDocumentIdentifier": "US 20130069001 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": False,
"inventorNameText": "Luo et al.",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"passageLocationText": ["par. 0129, 130 | F.2d"],
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"relatedClaimNumberText": "6",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "61c801c057ff235c5d17ac7d0dc83fed",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "Y",
"citedDocumentIdentifier": "US 4342881 A",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "Fukuda; Sunichi",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"passageLocationText": [
"col. 2 lines 7-10 | col. 2 line 6 col. 3 line 4 | F.2d"
],
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"relatedClaimNumberText": "2",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "9f516d0bd44a02a659cb95e5fe7e43c4",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "A",
"citedDocumentIdentifier": "US 20190315031 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "Asahi; Atsushi",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "8a3f9761f6edc6c6d590ac8598d50539",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "A",
"citedDocumentIdentifier": "US 9831056 B2",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "Mochizuki; Hirofumi",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "a937b9747f887cb36609892ff48911ea",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "A",
"citedDocumentIdentifier": "US 20070075822 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "Pachla; Timothy E.",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "c0cabbd997071a8b56f5c3c39a49c87f",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "A",
"citedDocumentIdentifier": "US 20070018774 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "Dietsch; Gordon T.",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "bfb1e59486c613f384ea1b9d6f9a4707",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "A",
"citedDocumentIdentifier": "US 20140356671 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "Dawley; Evan J.",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "f83f64c0fd7db562362efc816d3eed92",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "A",
"citedDocumentIdentifier": "US 20100178813 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "HOLBROOK; MEGHAN ANN",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "e1ddb9c1be3db9476042f265e56b1367",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "Y",
"citedDocumentIdentifier": "US 20030024105 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "Chiu, Tony",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"passageLocationText": [
"claim 1 | par. 0029 Fig. 4-7 | par. 0029 | F.2d | claim 3 | claim 5 | claim 7 | claim 2 | claim 4 | claim 6"
],
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"relatedClaimNumberText": "1-7",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
{
"id": "dd0ebf2bbf630c209bc17e7c8f8acf5e",
"applicantCitedExaminerReferenceIndicator": False,
"citationCategoryCode": "A",
"citedDocumentIdentifier": "US 20180294126 A1",
"createDateTime": "2021-12-10T23:10:13Z",
"createUserIdentifier": "ETL_SYS",
"examinerCitedReferenceIndicator": True,
"inventorNameText": "de Leon; Conrado",
"obsoleteDocumentIdentifier": "KVRDZCSADFLYX10",
"officeActionCategory": "CTNF",
"officeActionDate": "2021-11-10T00:00:00Z",
"patentApplicationNumber": "15931761",
"qualitySummaryText": "AOK",
"groupArtUnitNumber": "2835",
"techCenter": "2800",
"workGroup": "2830",
},
],
},
}
Answered By - Andrej Kesely Answer Checked By - Pedro (WPSolving Volunteer)