The U.S. Patent and Trademark Office has a public API for accessing certain patent data. I was previously accessing their PAIR Bulk Data API via AJAX, but for some time that has thrown a security error that the certificate is invalid.
They replaced PAIR Bulk Data API with a new one called Patent Examination Data System (PEDS) using https://ped.uspto.gov/api/queries. I have successfully tested the /queries functionality of the PEDS API using the Swagger UI at https://ped.uspto.gov/api/swagger-ui.html#!/queries/searchDataUsingPOST.
I have no issues testing PEDS queries on the Swagger UI page, but when I try to implement it on my website, I receive the following error in the Safari console (and a similar one in Chrome of course):
[Error] Failed to load resource: Origin http://www.WEBSITE.com is not allowed by Access-Control-Allow-Origin.
[Error] XMLHttpRequest cannot load https://ped.uspto.gov/api/queries. Origin http://www.WEBSITE.com is not allowed by Access-Control-Allow-Origin.
Here is the request I am sending:
$.ajax({
type: 'POST',
url: 'https://ped.uspto.gov/api/queries',
contentType: 'application/json',
dataType: 'text',
data: '{"df":"patentNumber","searchText":"' + no + '","facet":"false"}',
success: function(data) {
alert(“success");
}
})
Any idea why I would get the “not allowed by Access-Control-Allow-Origin” error for this public API?
I used to successfully use a similar request for the PAIR Bulk Data API and I never had this issue.