Help

API Fetch Error: "Invalid SSL Certificate"

Topic Labels: API Scripting
764 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Smithn27
4 - Data Explorer
4 - Data Explorer

I am trying to use an external API to automatically update some fields in my base based on a record ID using the script below.

let table = base.getTable("Tracker");
let view = table.getView("US");
let query = await view.selectRecordsAsync({
fields: ["appNo"],
});

for (let record of query.records) {
let patentStatus = await remoteFetchAsync(`https://developer.uspto.gov/ibd-api/v1/application/publications?patentApplicationNumber=${(`${record.getCellValueAsString("AppNo")}`)}`)
let data = await patentStatus.json()

But when I run the request the response I get back is an error with the message "Invalid SSL Certificate."

If there a way to work around this in Airtable?

1 Reply 1
preshetin
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi @Smithn27 - the problem is with with USPTO API. According to this StackOverflow answer, their API is vulnerable to hacker attacks. This is why the usual fetch requests blocks it.

As a workaround, I quickly crafted API endpoint that lowers security of an ordinary fetch requests. As an urgent solution, you may use this endpoint in your script. You may want to deploy it at your own AWS account. Here is Github repo of the API endpoint that I made.

So, to make your script work, change this

https://developer.uspto.gov/ibd-api/v1/application/publications

to a workaround URL that I quickly crafted:

https://1vgl5jl56l.execute-api.us-east-1.amazonaws.com

This way your `patentStatus` variable should look like this:

let patentStatus = await remoteFetchAsync(`https://1vgl5jl56l.execute-api.us-east-1.amazonaws.com?patentApplicationNumber=${(`${record.getCellValueAsString("appNo")}`)}`);

Note that I am not planning to keep that URL alive so you should probably install this Lambda function to your own AWS account. 

Also, let me quote that StackOverflow answer:

If this is a third party service, you should consider contacting them or using a different service as they are leaving themselves open to the Logjam attack which is also discussed in the answer linked above.

If you need any help please let me know