PatentsView-compatible
Citations
One row per citation a granted patent makes: to US patents, US applications, foreign documents and other references, plus the related-application text of patents and publications.
Send q, f, s and o as one JSON body with POST, or as JSON-encoded query parameters with GET.
{
"error": false,
"count": 1,
"total_hits": 1,
"us_patent_citations": [
{
"patent_id": "12756070",
"citation_patent_id": "10476114",
"citation_category": "cited by examiner",
"citation_date": "2019-11-01"
}
]
}Request body
The query. A field and value matches exactly; combine clauses with _and, _or and _not. Dates use YYYY-MM-DD.
Fields to return. Name a group such as assignees to get all of its fields, or one field such as assignees.assignee_organization.
Sort order, for example [{"patent_date": "desc"}]. Only sortable fields are allowed; end with a unique field to keep paging stable.
sizeRows per page. Default 100, up to 1,000. 0 returns only the count.afterCursor: the last row's sort values, in sort order.offsetSkip rows. Don't combine with after.Operators and cursor paging work as on Patents.
curl https://api.patentgrep.com/api/v1/patent/us_patent_citation/ \
-H "X-Api-Key: $PATENTGREP_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": {"patent_id": "12756070"},
"f": [
"patent_id",
"citation_patent_id",
"citation_category",
"citation_date"
],
"o": {"size": 3}
}'import os, requests
resp = requests.post(
"https://api.patentgrep.com/api/v1/patent/us_patent_citation/",
headers={"X-Api-Key": os.environ["PATENTGREP_KEY"]},
json={
"q": {"patent_id": "12756070"},
"f": [
"patent_id",
"citation_patent_id",
"citation_category",
"citation_date"
],
"o": {"size": 3}
},
)
resp.raise_for_status()
data = resp.json()
print(data)const res = await fetch("https://api.patentgrep.com/api/v1/patent/us_patent_citation/", {
headers: {
"X-Api-Key": process.env.PATENTGREP_KEY,
"Content-Type": "application/json",
},
method: "POST",
body: JSON.stringify({
"q": {"patent_id": "12756070"},
"f": [
"patent_id",
"citation_patent_id",
"citation_category",
"citation_date"
],
"o": {"size": 3}
}),
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"q": {"patent_id": "12756070"},
"f": [
"patent_id",
"citation_patent_id",
"citation_category",
"citation_date"
],
"o": {"size": 3}
}`)
req, err := http.NewRequest(http.MethodPost, "https://api.patentgrep.com/api/v1/patent/us_patent_citation/", body)
if err != nil {
panic(err)
}
req.Header.Set("X-Api-Key", os.Getenv("PATENTGREP_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
if res.StatusCode != http.StatusOK {
panic(fmt.Sprintf("%s: %s", res.Status, data))
}
fmt.Println(string(data))
}require "json"
require "net/http"
uri = URI("https://api.patentgrep.com/api/v1/patent/us_patent_citation/")
req = Net::HTTP::Post.new(uri)
req["X-Api-Key"] = ENV.fetch("PATENTGREP_KEY")
req["Content-Type"] = "application/json"
req.body = <<~'JSON'
{
"q": {"patent_id": "12756070"},
"f": [
"patent_id",
"citation_patent_id",
"citation_category",
"citation_date"
],
"o": {"size": 3}
}
JSON
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
raise "#{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)
data = JSON.parse(res.body)
p data/api/v1/patent/us_patent_citation/
Rows come back in us_patent_citations. Without f you get patent_id, citation_patent_id, citation_patent, citation_category, citation_date, citation_name, citation_sequence, citation_wipo_kind.
| Field | Type | Sort | Description |
|---|---|---|---|
patent_id | string | Yes | The ID of the citing patent. |
citation_patent_id | string | No | The ID of the patent being cited. |
citation_patent | string | No | An API request URL for additional details of the patent being cited. |
citation_category | string | No | Who cited the patent (examiner, applicant, other etc). |
citation_date | date | Yes | First day of the month the cited patent (citation_id) was published. |
citation_name | string | No | Name associated with the citation. |
citation_sequence | integer | Yes | Order in which this citation is cited by patent; values for this field begin at 0. |
citation_wipo_kind | string | No | WIPO document kind codes associated with the citation. |
curl https://api.patentgrep.com/api/v1/patent/us_patent_citation/ \
-H "X-Api-Key: $PATENTGREP_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_patent_id",
"citation_patent",
"citation_category",
"citation_date",
"citation_name",
"citation_sequence",
"citation_wipo_kind"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}'import os, requests
resp = requests.post(
"https://api.patentgrep.com/api/v1/patent/us_patent_citation/",
headers={"X-Api-Key": os.environ["PATENTGREP_KEY"]},
json={
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_patent_id",
"citation_patent",
"citation_category",
"citation_date",
"citation_name",
"citation_sequence",
"citation_wipo_kind"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
},
)
resp.raise_for_status()
data = resp.json()
print(data)const res = await fetch("https://api.patentgrep.com/api/v1/patent/us_patent_citation/", {
headers: {
"X-Api-Key": process.env.PATENTGREP_KEY,
"Content-Type": "application/json",
},
method: "POST",
body: JSON.stringify({
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_patent_id",
"citation_patent",
"citation_category",
"citation_date",
"citation_name",
"citation_sequence",
"citation_wipo_kind"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}),
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_patent_id",
"citation_patent",
"citation_category",
"citation_date",
"citation_name",
"citation_sequence",
"citation_wipo_kind"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}`)
req, err := http.NewRequest(http.MethodPost, "https://api.patentgrep.com/api/v1/patent/us_patent_citation/", body)
if err != nil {
panic(err)
}
req.Header.Set("X-Api-Key", os.Getenv("PATENTGREP_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
if res.StatusCode != http.StatusOK {
panic(fmt.Sprintf("%s: %s", res.Status, data))
}
fmt.Println(string(data))
}require "json"
require "net/http"
uri = URI("https://api.patentgrep.com/api/v1/patent/us_patent_citation/")
req = Net::HTTP::Post.new(uri)
req["X-Api-Key"] = ENV.fetch("PATENTGREP_KEY")
req["Content-Type"] = "application/json"
req.body = <<~'JSON'
{
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_patent_id",
"citation_patent",
"citation_category",
"citation_date",
"citation_name",
"citation_sequence",
"citation_wipo_kind"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}
JSON
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
raise "#{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)
data = JSON.parse(res.body)
p data/api/v1/patent/us_application_citation/
Rows come back in us_application_citations. Without f you get patent_id, citation_document_number, citation_category, citation_date, citation_name, citation_sequence, citation_wipo_kind.
| Field | Type | Sort | Description |
|---|---|---|---|
patent_id | string | Yes | The ID of the citing patent. |
citation_document_number | string | No | Publication number of the pre-grant publication being cited. |
citation_category | string | No | Who cited the patent (examiner, applicant, other etc). |
citation_date | date | Yes | First day of the month the cited patent (citation_id) was published. |
citation_name | string | No | Name associated with the citation. |
citation_sequence | integer | Yes | Order in which this reference is cited by select patent; values for this field begin at 0. |
citation_wipo_kind | string | No | WIPO document kind codes associated with the citation. |
curl https://api.patentgrep.com/api/v1/patent/us_application_citation/ \
-H "X-Api-Key: $PATENTGREP_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_document_number",
"citation_category",
"citation_date",
"citation_name",
"citation_sequence",
"citation_wipo_kind"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}'import os, requests
resp = requests.post(
"https://api.patentgrep.com/api/v1/patent/us_application_citation/",
headers={"X-Api-Key": os.environ["PATENTGREP_KEY"]},
json={
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_document_number",
"citation_category",
"citation_date",
"citation_name",
"citation_sequence",
"citation_wipo_kind"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
},
)
resp.raise_for_status()
data = resp.json()
print(data)const res = await fetch("https://api.patentgrep.com/api/v1/patent/us_application_citation/", {
headers: {
"X-Api-Key": process.env.PATENTGREP_KEY,
"Content-Type": "application/json",
},
method: "POST",
body: JSON.stringify({
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_document_number",
"citation_category",
"citation_date",
"citation_name",
"citation_sequence",
"citation_wipo_kind"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}),
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_document_number",
"citation_category",
"citation_date",
"citation_name",
"citation_sequence",
"citation_wipo_kind"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}`)
req, err := http.NewRequest(http.MethodPost, "https://api.patentgrep.com/api/v1/patent/us_application_citation/", body)
if err != nil {
panic(err)
}
req.Header.Set("X-Api-Key", os.Getenv("PATENTGREP_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
if res.StatusCode != http.StatusOK {
panic(fmt.Sprintf("%s: %s", res.Status, data))
}
fmt.Println(string(data))
}require "json"
require "net/http"
uri = URI("https://api.patentgrep.com/api/v1/patent/us_application_citation/")
req = Net::HTTP::Post.new(uri)
req["X-Api-Key"] = ENV.fetch("PATENTGREP_KEY")
req["Content-Type"] = "application/json"
req.body = <<~'JSON'
{
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_document_number",
"citation_category",
"citation_date",
"citation_name",
"citation_sequence",
"citation_wipo_kind"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}
JSON
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
raise "#{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)
data = JSON.parse(res.body)
p data/api/v1/patent/foreign_citation/
Rows come back in foreign_citations. Without f you get patent_id, citation_number, citation_category, citation_date, citation_country, citation_sequence.
| Field | Type | Sort | Description |
|---|---|---|---|
patent_id | string | Yes | The ID of the citing patent. |
citation_number | string | No | The document number of the cited foreign patent. |
citation_category | string | No | Who cited the patent (examiner, applicant, other etc). |
citation_date | date | Yes | First day of the month the cited patent (citation_id) was published. |
citation_country | string | No | Country patent/application (number) was filed. |
citation_sequence | integer | Yes | Order in which this citation is cited by patent; values for this field begin at 0. |
curl https://api.patentgrep.com/api/v1/patent/foreign_citation/ \
-H "X-Api-Key: $PATENTGREP_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_number",
"citation_category",
"citation_date",
"citation_country",
"citation_sequence"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}'import os, requests
resp = requests.post(
"https://api.patentgrep.com/api/v1/patent/foreign_citation/",
headers={"X-Api-Key": os.environ["PATENTGREP_KEY"]},
json={
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_number",
"citation_category",
"citation_date",
"citation_country",
"citation_sequence"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
},
)
resp.raise_for_status()
data = resp.json()
print(data)const res = await fetch("https://api.patentgrep.com/api/v1/patent/foreign_citation/", {
headers: {
"X-Api-Key": process.env.PATENTGREP_KEY,
"Content-Type": "application/json",
},
method: "POST",
body: JSON.stringify({
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_number",
"citation_category",
"citation_date",
"citation_country",
"citation_sequence"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}),
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_number",
"citation_category",
"citation_date",
"citation_country",
"citation_sequence"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}`)
req, err := http.NewRequest(http.MethodPost, "https://api.patentgrep.com/api/v1/patent/foreign_citation/", body)
if err != nil {
panic(err)
}
req.Header.Set("X-Api-Key", os.Getenv("PATENTGREP_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
if res.StatusCode != http.StatusOK {
panic(fmt.Sprintf("%s: %s", res.Status, data))
}
fmt.Println(string(data))
}require "json"
require "net/http"
uri = URI("https://api.patentgrep.com/api/v1/patent/foreign_citation/")
req = Net::HTTP::Post.new(uri)
req["X-Api-Key"] = ENV.fetch("PATENTGREP_KEY")
req["Content-Type"] = "application/json"
req.body = <<~'JSON'
{
"q": {"patent_id": "10000000"},
"f": [
"patent_id",
"citation_number",
"citation_category",
"citation_date",
"citation_country",
"citation_sequence"
],
"s": [{"patent_id": "asc"}, {"citation_sequence": "asc"}],
"o": {"size": 25}
}
JSON
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
raise "#{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)
data = JSON.parse(res.body)
p data/api/v1/patent/other_reference/
Rows come back in other_references. Without f you get patent_id, reference_sequence, reference_text.
| Field | Type | Sort | Description |
|---|---|---|---|
patent_id | string | Yes | The ID of the citing patent. |
reference_sequence | string | Yes | The order in which this reference appears in the raw XML for the current patent; sequence for this table starts at 0. |
reference_text | string | No | The text of the reference to a non-patent, non-application source. |
curl https://api.patentgrep.com/api/v1/patent/other_reference/ \
-H "X-Api-Key: $PATENTGREP_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": {"patent_id": "10000000"},
"f": ["patent_id", "reference_sequence", "reference_text"],
"s": [{"patent_id": "asc"}, {"reference_sequence": "asc"}],
"o": {"size": 25}
}'import os, requests
resp = requests.post(
"https://api.patentgrep.com/api/v1/patent/other_reference/",
headers={"X-Api-Key": os.environ["PATENTGREP_KEY"]},
json={
"q": {"patent_id": "10000000"},
"f": ["patent_id", "reference_sequence", "reference_text"],
"s": [{"patent_id": "asc"}, {"reference_sequence": "asc"}],
"o": {"size": 25}
},
)
resp.raise_for_status()
data = resp.json()
print(data)const res = await fetch("https://api.patentgrep.com/api/v1/patent/other_reference/", {
headers: {
"X-Api-Key": process.env.PATENTGREP_KEY,
"Content-Type": "application/json",
},
method: "POST",
body: JSON.stringify({
"q": {"patent_id": "10000000"},
"f": ["patent_id", "reference_sequence", "reference_text"],
"s": [{"patent_id": "asc"}, {"reference_sequence": "asc"}],
"o": {"size": 25}
}),
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"q": {"patent_id": "10000000"},
"f": ["patent_id", "reference_sequence", "reference_text"],
"s": [{"patent_id": "asc"}, {"reference_sequence": "asc"}],
"o": {"size": 25}
}`)
req, err := http.NewRequest(http.MethodPost, "https://api.patentgrep.com/api/v1/patent/other_reference/", body)
if err != nil {
panic(err)
}
req.Header.Set("X-Api-Key", os.Getenv("PATENTGREP_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
if res.StatusCode != http.StatusOK {
panic(fmt.Sprintf("%s: %s", res.Status, data))
}
fmt.Println(string(data))
}require "json"
require "net/http"
uri = URI("https://api.patentgrep.com/api/v1/patent/other_reference/")
req = Net::HTTP::Post.new(uri)
req["X-Api-Key"] = ENV.fetch("PATENTGREP_KEY")
req["Content-Type"] = "application/json"
req.body = <<~'JSON'
{
"q": {"patent_id": "10000000"},
"f": ["patent_id", "reference_sequence", "reference_text"],
"s": [{"patent_id": "asc"}, {"reference_sequence": "asc"}],
"o": {"size": 25}
}
JSON
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
raise "#{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)
data = JSON.parse(res.body)
p data/api/v1/patent/rel_app_text/
Rows come back in rel_app_texts. Without f you get patent_id, related_text.
| Field | Type | Sort | Description |
|---|---|---|---|
patent_id | string | Yes | Patent number. |
related_text | string | No | The text of the description of the related application in question. |
curl https://api.patentgrep.com/api/v1/patent/rel_app_text/ \
-H "X-Api-Key: $PATENTGREP_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": {"patent_id": "10000000"},
"f": ["patent_id", "related_text"],
"s": [{"patent_id": "asc"}],
"o": {"size": 25}
}'import os, requests
resp = requests.post(
"https://api.patentgrep.com/api/v1/patent/rel_app_text/",
headers={"X-Api-Key": os.environ["PATENTGREP_KEY"]},
json={
"q": {"patent_id": "10000000"},
"f": ["patent_id", "related_text"],
"s": [{"patent_id": "asc"}],
"o": {"size": 25}
},
)
resp.raise_for_status()
data = resp.json()
print(data)const res = await fetch("https://api.patentgrep.com/api/v1/patent/rel_app_text/", {
headers: {
"X-Api-Key": process.env.PATENTGREP_KEY,
"Content-Type": "application/json",
},
method: "POST",
body: JSON.stringify({
"q": {"patent_id": "10000000"},
"f": ["patent_id", "related_text"],
"s": [{"patent_id": "asc"}],
"o": {"size": 25}
}),
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"q": {"patent_id": "10000000"},
"f": ["patent_id", "related_text"],
"s": [{"patent_id": "asc"}],
"o": {"size": 25}
}`)
req, err := http.NewRequest(http.MethodPost, "https://api.patentgrep.com/api/v1/patent/rel_app_text/", body)
if err != nil {
panic(err)
}
req.Header.Set("X-Api-Key", os.Getenv("PATENTGREP_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
if res.StatusCode != http.StatusOK {
panic(fmt.Sprintf("%s: %s", res.Status, data))
}
fmt.Println(string(data))
}require "json"
require "net/http"
uri = URI("https://api.patentgrep.com/api/v1/patent/rel_app_text/")
req = Net::HTTP::Post.new(uri)
req["X-Api-Key"] = ENV.fetch("PATENTGREP_KEY")
req["Content-Type"] = "application/json"
req.body = <<~'JSON'
{
"q": {"patent_id": "10000000"},
"f": ["patent_id", "related_text"],
"s": [{"patent_id": "asc"}],
"o": {"size": 25}
}
JSON
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
raise "#{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)
data = JSON.parse(res.body)
p data/api/v1/publication/rel_app_text/
Rows come back in rel_app_texts. Without f you get document_number, related_text.
| Field | Type | Sort | Description |
|---|---|---|---|
document_number | string | Yes | Unique identifier for the related application publication. |
related_text | string | No | Text related to the application, providing additional details or context. |
curl https://api.patentgrep.com/api/v1/publication/rel_app_text/ \
-H "X-Api-Key: $PATENTGREP_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": {"document_number": "20180123164"},
"f": ["document_number", "related_text"],
"s": [{"document_number": "asc"}],
"o": {"size": 25}
}'import os, requests
resp = requests.post(
"https://api.patentgrep.com/api/v1/publication/rel_app_text/",
headers={"X-Api-Key": os.environ["PATENTGREP_KEY"]},
json={
"q": {"document_number": "20180123164"},
"f": ["document_number", "related_text"],
"s": [{"document_number": "asc"}],
"o": {"size": 25}
},
)
resp.raise_for_status()
data = resp.json()
print(data)const res = await fetch("https://api.patentgrep.com/api/v1/publication/rel_app_text/", {
headers: {
"X-Api-Key": process.env.PATENTGREP_KEY,
"Content-Type": "application/json",
},
method: "POST",
body: JSON.stringify({
"q": {"document_number": "20180123164"},
"f": ["document_number", "related_text"],
"s": [{"document_number": "asc"}],
"o": {"size": 25}
}),
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"q": {"document_number": "20180123164"},
"f": ["document_number", "related_text"],
"s": [{"document_number": "asc"}],
"o": {"size": 25}
}`)
req, err := http.NewRequest(http.MethodPost, "https://api.patentgrep.com/api/v1/publication/rel_app_text/", body)
if err != nil {
panic(err)
}
req.Header.Set("X-Api-Key", os.Getenv("PATENTGREP_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
if res.StatusCode != http.StatusOK {
panic(fmt.Sprintf("%s: %s", res.Status, data))
}
fmt.Println(string(data))
}require "json"
require "net/http"
uri = URI("https://api.patentgrep.com/api/v1/publication/rel_app_text/")
req = Net::HTTP::Post.new(uri)
req["X-Api-Key"] = ENV.fetch("PATENTGREP_KEY")
req["Content-Type"] = "application/json"
req.body = <<~'JSON'
{
"q": {"document_number": "20180123164"},
"f": ["document_number", "related_text"],
"s": [{"document_number": "asc"}],
"o": {"size": 25}
}
JSON
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
raise "#{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)
data = JSON.parse(res.body)
p data