Skip to main content

Update Event

PUT https://app.jiter.dev/api/events/:eventId

You can update any events that have a status of Pending.

Request Parameters

ParameterDescriptionExample
eventIdID of the event you want to update47

Request Body Parameters

ParameterDescriptionExample
payloadYour stringified payload'{"action":"buyGroceries","values":["eggs","bacon","pasta","bread"]}'
destinationThe endpoint we should send your event tohttps://your-app.com/webhooks/jiter
statusThe event status - can only be set to CancelledCancelled

Response

CodeDescription
200Event updated successfully
400Bad request - either in the body or trying to update an event that is not Pending
404We were unable to find the event
500Unable to update the event

Example Usage

index.ts
import axios from "axios";

const apiBaseUrl = "https://app.jiter.dev/api";

const updateEvent = async () => {
try {
const { data } = await axios.put(
`${apiBaseUrl}/events/47`,
{
destination: "https://your-new-app-url.com/webhooks/jiter",
payload: JSON.stringify({
action: "returnGroceries",
values: [{ bacon: "Too addictive" }, { eggs: "Break too easily" }],
}),
status: "Cancelled",
},
{ headers: { "x-api-key": "YOUR_API_KEY" } }
);

console.log("Event updated 🎉", data);
} catch (error) {
console.log("Unable to update event", error);
}
};

updateEvent();

Example Success Response

{
"id": "47",
"scheduledTime": "2022-10-27T04:50:26.573Z",
"destination": "https://your-new-app-url.com/webhooks/jiter",
"org": "5",
"status": "Cancelled",
"payload": "{'action':'returnGroceries','values':[{'bacon':'Too addictive'},{'eggs':'Break too easily'}]}",
"createdAt": "2022-10-05T19:51:27.000Z",
"updatedAt": "2022-10-05T24:17:12.000Z"
}

Example Error Response

{
"message": "Please make sure your scheduled time is in the future."
}