I’m working with Zapier CLI and trying to set up a resource that can handle update operations. From what I can see in the resource schema documentation, there’s only support for creates operations. I need to figure out how to configure an update operation that will trigger a PUT request to my REST API endpoint. I’ve been going through the docs but can’t find any clear examples or guidance on this. Has anyone successfully implemented update functionality in their Zapier resources? What’s the proper way to structure this in the resource definition? Any help would be appreciated since I’m stuck on this part of my integration.
When dealing with updates in Zapier, you can indeed use a single resource that accommodates both creation and updating. You can set your endpoint to accept both POST and PUT methods. In your implementation, check for an ID in the bundle.inputData.id within your performCreate function. If an ID is present, switch options.method to ‘PUT’ and append the ID to the endpoint URL. Be sure your backend can process this correctly. This approach also means you can offer users the flexibility to create new records or update existing ones.
Had this exact problem a few months ago when building my own integration. Zapier CLI doesn’t have a dedicated update operation, but there’s a workaround. Just modify your create function - add a conditional check in performCreate that looks for an existing record ID in the input. If it finds one, switch the HTTP method from POST to PUT and update the URL to include that ID. Don’t forget to add an optional ID field to your inputs so users can specify which record they want to update. You can grab all the data through bundle.inputData. Just make sure your API endpoint handles both create and update scenarios.
yeah, this is tricky but totally doable. hack the create operation to handle updates too. in your perform function, check if there’s an id field - if yes, change the method to put and modify the url. something like if (bundle.inputData.id) { options.method = 'PUT'; options.url += '/' + bundle.inputData.id; } worked for me. just add the id as an optional input field.