We have been working on a custom block to write data from airtable into the Sanity CND with great success. We were able to use the record ID’s from airtable as the ID’s in Sanity.
Now we are attempting the reverse with a GET request and this has been much more difficult. We have had to create logic for the id’s to be created in each application to be used by the other. This became even more complex today when we realized that a reference tag from a tag able was itself a record and still and instance of a record all over our second table.
We are using a listener and Sanity uses documents and each has an id but the json response does not include the document id along side the transaction id. Any advice on how to go about patching multiple tables together? Or is this just over all a really bad idea? We have also requested from Sanity to see if they can add the document ID to the json response or if somehow we can find it using the transaction id.
I’m not familiar with Sanity or its API. To clarify, it sounds like you’re trying to create records in Airtable by pulling data from the Sanity CDN. It also sounds like there’s a linked table relationship in the base you’re pulling into. Some questions I have:
If there is a linked relationship, how is that relationship represented in the CDN?
Are you attempting to only create records in Airtable, or is it a patch operation (create/update)?
If you’re setting up a synced relationship between Airtable / Sanity, I imagine you’ll need some breadcrumb on both sides so that you can map each Airtable record to a Sanity row (for instance, a “Sanity Document ID” field in Airtable, and “Airtable Record ID” column in Sanity). Then you can identify previously-synced records to update versus creating new ones.
Ok thanks! I have one other question maybe you can help with. I need to find the http: URL for my block example https://devblock–zbxp-ed-pw-y1yp1-x–00474so.airtableblocks.com I am using this to authorize Sanity. Previously I got this from the console is their a better way to find this information? In the last week it seems to no longer give this on a CORS error in console.