you need to check if the response is an array. if the api returns a list, you must index it. try $.payload[0].id instead of $.payload.id. also verify the content-type header is application/json. sometimes architect fails to parse xml or plain text automatically.
Have you tried validating the raw response payload against the expected schema before mapping? The undefined result usually indicates a JSON parsing failure or a type mismatch in the Architect Data Action configuration. If the endpoint returns a string instead of a JSON object, the JSON path $.payload.id will fail silently. Check the Content-Type header in the response. It must be application/json. If it is text/plain, Architect will treat the body as a string, breaking the path extraction.
To debug, add a Transform Data action immediately after the REST call to log the raw body. Use this expression to inspect the type:
if (typeof $DataActionOutput.body === 'string') {
// Parse manually if needed
let parsed = JSON.parse($DataActionOutput.body);
return parsed.payload.id;
}
return $DataActionOutput.body.payload.id;
Also verify the Success Condition in the Data Action. If the HTTP status is 200 but the body contains an error flag like {"status": "error"}, the action might still succeed technically but return malformed data. Ensure your custom endpoint strictly adheres to RFC 8259 JSON standards. No trailing commas, proper double quotes.