Airtable View works in URL but not entirely in script
pangeli opened this issue · comments
I deployed a Worker script to view my Airtable table called “main”.
My worker.js script is as follow in the specific section:
const config = { ...Object({"airtableApiUrl":"https://api.airtable.com","airtableBaseId":"appzXXXXXX”,”airtableApiVersion":"v0","airtableApiKey":"keyXXXXXX","cacheTime":0,"prefix":"","allowedTargets":"*"}) };
const parseJson = obj => {
try {
return JSON.parse(obj);
} catch (e) {
return obj;
}
};
My Worker URL is working perfectly when I visit: https://myurl.workers.dev/main and I can see my whole table.
Now if I modify the airtableBaseId value to “appzXXXXXXX/main”
const config = { ...Object({"airtableApiUrl":"https://api.airtable.com","airtableBaseId":"appzXXXXXXX/main",”airtableApiVersion":"v0","airtableApiKey":"keyXXXXXX","cacheTime":0,"prefix":"","allowedTargets":"*"}) };
const parseJson = obj => {
try {
return JSON.parse(obj);
} catch (e) {
return obj;
}
};
Then I can see my whole base directly from the root Worker URL https://myurl.workers.dev/
I would like to see another view from the same Airtable table called “myview”
If I type https://myurl.workers.dev/?view=myview then I can see the specific view in my browser directly.
But if I try to hard code the query string value to airtableBaseId like appzXXXXXXX/main/?view=myview then I get a 422 Unprocessable Entity with this response:
{"error":{"type":"VIEW_NAME_NOT_FOUND","message":"View myview/ not found"}}
@pangeli did you figure it out? I'll try to look at this in depth next week if not.
Thanks!
@karllhughes I'm just using another table instead and it works fine. Thanks again for your time!
Hi @karllhughes first and foremost thanks for this project, that's a great way to kick start an Airtable API implementation.
I was wondering if by any chance you worked (or plan to work) on an easy way to fetch views as well?
@ruinyourfun You should be able to get views using query strings that are provided in the Airtable API.
This is just a proxy, so all those query strings get passed back upstream.
@karllhughes Of course 🤦 thanks for your time.