Retrying HTTP Requests
Property
Type
Default
Description
1
Send Order to Primary Warehouse (With Retry)
(data) => {
const { input } = data;
return {
"lam.httpRequest": {
method: "POST",
url: "{{config.primaryWarehouseUrl}}/api/orders",
headers: {
Authorization: "Bearer {{config.warehouseApiKey}}",
"Content-Type": "application/json",
},
body: {
orderId: input.orderId,
items: input.items,
priority: "high",
shippingAddress: input.shippingAddress,
},
// added here
retry: {
maxAttempts: 3,
},
},
};
};2
Update Multiple Services (Batch Retry)
(data) => {
const { input } = data;
const fulfillmentResponse = data.step_2.response || data.step_1.response;
return {
"lam.httpRequests": [
{
method: "PUT",
url: `{{config.orderServiceUrl}}/orders/${input.orderId}/status`,
headers: {
Authorization: "Bearer {{config.orderServiceKey}}",
},
body: {
status: "processing",
trackingNumber: fulfillmentResponse.trackingNumber,
warehouse: fulfillmentResponse.warehouseId,
},
// added here
retry: {
maxAttempts: 2,
},
},
{
method: "POST",
url: "{{config.notificationServiceUrl}}/send-confirmation",
headers: {
Authorization: "Bearer {{config.notificationKey}}",
},
body: {
customerId: input.customerId,
orderId: input.orderId,
trackingNumber: fulfillmentResponse.trackingNumber,
type: "order_confirmed",
},
// added here
retry: {
maxAttempts: 4,
},
},
],
};
};Last updated
Was this helpful?