Hello! this is my first time using the scripting block and first time trying to use an API with code (I’ve used lots of no-code tools in the past; Zapier, Integromat etc.)
I want to use a text field in my base to create a ‘tag’ in Toggl using the Toggl api;
The Toggl API documentation looks good, and I think I understand most of it, but I don’t know how to actually start - what is the first think I need to write?
All the toggl examples start with ‘curl’ e.g.
curl -v -u 1971800d4d82861d8f2c1651fea4d212:api_token \
-H "Content-Type: application/json" \
-d '{"time_entry":{"description":"New time entry","created_with":"API example code","start":"2012-02-12T15:35:47+02:00","duration":1200,"wid":31366}}' \
-X POST https://api.track.toggl.com/api/v8/time_entries
Is this what I would paste into the script editor?
I assume I need the toggle api url somewhere ( api.track.toggl.com) so the script knows where to get/post the data but I don’t know where or how to add this url.
Can someone please point me in the right direction?
Cheers!
You can start with fetch. See the documentation for more info on how Airtable implements fetch. You can also Google how to convert a curl request to a fetch request.
SyntaxError: Unexpected identifier
on line 1
at o on line 1
at Generator._invoke on line 1
at Generator.F.forEach.u. [as next] on line 1
at u on line 1
at a on line 1
on line 1
on line 1
Looking at the airtable fetch documentation I can’t figure out what this error code is trying to say.
This was really helpful @kuovonne! I’m trying to do something similar: creating a user in Softr when an Airtable user gets created in my table.
I’m so close to getting this working based on your feedback, but I get back a 'Bad Request" that “User email field can’t be empty” even though I’m passing the email from airtable to softr in the script I’m using.
What am I doing wrong here? I can’t figure out how to structure the email field correctly.