Build a REST integration
End to end: connection alias, credential, REST message, flow action and error handling.
End to end: connection alias, credential, REST message, flow action and error handling.
- Connection aliases keep environments separate
- Test the method before writing code
- Handle non success codes explicitly
- Log correlation ids and name an owner
Set up connection and credential
Create a credential record for the secret and a connection alias pointing at the endpoint. Each environment gets its own connection record under the same alias, so nothing in your logic changes between dev, test and production.
Create the REST message
Add the message and one method per operation, using the alias rather than a hard coded URL. Use the Test link to confirm the call works before writing any code.
Call it from automation
Prefer a flow action so the integration is visible to non developers, and add error handling.
// script step or script include used by the action
var r = new sn_ws.RESTMessageV2('Acme Orders', 'createOrder');
r.setRequestBody(JSON.stringify(payload));
r.setHttpTimeout(15000);
var resp = r.execute();
var code = resp.getStatusCode();
return { status: code, body: code == 201 ? resp.getBody() : resp.getErrorMessage() };Make it operable
Log the correlation id returned by the provider, alert on repeated failures, and document who to call when the endpoint is down. An integration without an owner becomes an outage nobody can fix.