I am trying to use Suitescript to connect to a MediaWiki API. I can't seem to find any examples specific to NetSuite. I understand the concept but I don't know what methods to use specifically. I am developing a RESTlet.
Asked
Active
Viewed 3,527 times
3 Answers
3
You can use the https module, if you are wanting to call an external API, RESTlet, URL, etc... A very simple GET example is below (this is a . For more, check out the N/https Module in the NetSuite help section.
/**
* @NApiVersion 2.0
* @NScriptType Restlet
* @ModuleScope SameAccount
*/
define(['N/https'],function(https){
function getRequest(params){
var headersObj={
name:'Content-Type',
value:'application/json'
};
var apiResponse=https.get({
url:'https://www.EnterURLHere.com',
headers:headersObj
});
log.debug('apiResponse',JSON.stringify(apiResponse));
return apiResponse;
}
return{
'get':getRequest
}
});

w3bguy
- 2,215
- 1
- 19
- 34
1
RESTlet are for when you are sending data into NetSuite. If you are sending data out, I have usually done it via scheduled or map/reduce script and using the https
module.

Rusty Shackles
- 2,802
- 10
- 11
0
RESTlet is used when you pull data from Netsuite or push data into Netsuite. RESTlet deployment will expose an internet url for your client call. If you want to call outside application from Netsuite, you can use scheduled or map/reduce script with the https or http module.

Charles Zhang
- 81
- 2