SuiteScript 1.0 to 2.1 reference

nlapiRequestURL in SuiteScript 2.1

In SuiteScript 2.1, nlapiRequestURL is replaced by https.get / https.post / https.request from N/https. Calls an external HTTP endpoint.

Before and after

// SuiteScript 1.0
var res = nlapiRequestURL('https://api.example.com/rates', null, { Accept: 'application/json' });
var data = JSON.parse(res.getBody());
// SuiteScript 2.1
define(['N/https'], (https) => {
  const res = https.get({
    url: 'https://api.example.com/rates',
    headers: { Accept: 'application/json' },
  });
  const data = JSON.parse(res.body);
});

What to watch for

  • getBody() and getCode() become the body and code properties.
  • Use https.post with a body for POST requests; https.request takes an explicit method.

Related functions

Find what still needs converting

Find every script that still calls nlapiRequestURL

SuiteMigrate lists the active 1.0 and 2.0 scripts in your NetSuite account, shows which ones you can read and which are locked, and drafts 2.1 conversions you review before deploying. Free for 5 conversions.

Add to Chrome — freeRead the migration guide

Examples are simplified. Test converted code in a NetSuite sandbox before deploying. SuiteMigrate is not affiliated with Oracle or NetSuite.