Public
Script
March 18, 2024
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// I was able to get this script to work from my browser console, but
// it's not working in ValTown or from Airtable's scripting environment.
// My best guess is that it has something to do with the headers not looking
// quite right to Substack when we hit their API.
const email = "avery.sara.james@gmail.com";
const result = await fetch("https://blog.edgeesmeralda.com/api/v1/free", {
"headers": {
"content-type": "application/json",
"sec-ch-ua": "\"Chromium\";v=\"122\", \"Not(A:Brand\";v=\"24\", \"Google Chrome\";v=\"122\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"macOS\"",
},
"referrer": "https://blog.edgeesmeralda.com/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body":
`{\"first_url\":\"https://blog.edgeesmeralda.com/\",\"first_referrer\":\"\",\"current_url\":\"https://blog.edgeesmeralda.com/\",\"current_referrer\":\"\",\"referral_code\":\"\",\"source\":\"home-sitemap\",\"referring_pub_id\":\"\",\"additional_referrin
"method": "POST",
"mode": "cors",
"credentials": "omit",
});
console.log(await result.text());
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 18, 2024