0

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.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Scott
  • 31
  • 3

1 Answers1

0

They haven't opened up the access control headers. If they're unreachable for complaint or correction then you'll have to use something on your server to pull the information from the api and serve it to your ajax. I typically use cURL with php but all server side scripting languages will have similar functionaility.

Altimus Prime
  • 2,207
  • 2
  • 27
  • 46