Skip to content

Idempotent requests

Idempotency is used for safely retrying requests without accidentally performing the same operation twice. On certain API endpoints API , you can use the optional metaId (eg. ‘my_product_123’) key. Then, if a connection error occurs, you can safely repeat the request without risk of performing the trigger twice.

const axios = require('axios');
axios({
method: "post",
url: "https://live.waypointapi.com/v1/email_messages",
headers: {
"Content-Type": "application/json"
},
auth: {
username: API_KEY_USERNAME,
password: API_KEY_PASSWORD
},
data: {
"templateId": "wptemplate_ABc123XYZ",
"metaId": "my_product_123",
"to": "jordan@usewaypoint.com",
"variables": {
"user": {
"displayName": "Jordan",
}
"product": {
"title": "Beechers Mac & Cheese",
"id": "02934203942"
}
}
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
})