โ† Home
๐Ÿ”ฅ0 DAY
โšก0 XP

Scripted REST API

A Scripted REST API is a custom inbound web service that exposes /api/<namespace>/<api-id>/<resource>, where your server script reads the request and builds the response.

Also searched as: inbound REST, custom REST endpoint, sys_ws_definition.

In practice

Each resource has its own HTTP method, relative path, and script receiving request and response objects. Security is enforced by the ACLs on the API plus the roles on the resource; the caller's session determines table access. Outbound calls are the opposite direction and use RESTMessageV2.

Example

GET /api/x_acme_hr/cases/open returns the caller's open HR cases as JSON built from a GlideRecord query.

(function process(request, response) {
  var out = [];
  var gr = new GlideRecord('incident');
  gr.addQuery('caller_id', gs.getUserID());
  gr.addQuery('active', true);
  gr.query();
  while (gr.next()) out.push({ number: gr.getValue('number') });
  return out;
})(request, response);

What interviewers check

Expect to debug a 500 response: transaction log, system log, payload validation, then ACLs โ€” and to mention idempotency for retries.

Practise this topic

Related Integration terms