NetSuite RESTlets
Attach file
The Attach File RESTlet uses a RESTful HTTP call to attach a file from the NetSuite file cabinet to another record.
The attached file will appear in the files sublist generally found on the messages or communication sub-tab.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_attachfile&deploy=customdeploy_dsi_attachfile
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST, PUT
Input
Input fields
Field name | Required | Details |
---|---|---|
fieldlid | Yes | Internal ID of the file |
attachto | Yes | Internal ID of the target record |
attachtype | Yes | Record Type of the target record |
mc_user | No | User name to be recorded in Last Advanced Inventory User on the target record |
If the GET method is used, the values for the input fields will be in the base URL. https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_attachfile&deploy=customdeploy_dsi_attachfile&fileid=&attachto=&attachtype=
If the POST or PUT methods are used, the body of the request will be JSON.
Input JSON template
{ "mc_user": "", "fileid": "", "attachto": "", "attachtype": "" }
Output
The RESTlet returns either a NetSuite error object or the internal ID of the target record to indicate success.
Output JSON template
Success:
{ "id": "" }Error:
{ "error": { "code": "", "message": "" } }
Attach/detach record
The Attach Record RESTlet uses a RESTful HTTP call to attach or detach one NetSuite record with another record. This RESTlet currently works with the following related records.
Attach Relationships
-
A support case to an issue
-
A contact to any customer, partner, vendor, lead, prospect, or project
-
A file to any transaction, item, activity, custom, or entity record
-
A custom child record to a supported parent record
-
An entity to a static entity group
Detach Relationships
-
Issue detached from support case
-
Contact detached from customer, partner, vendor, lead, prospect, or project
-
File detached from any transaction, item, activity, custom, or entity record
-
Custom child record detached from supported parent record
-
Entity detached from a static entity group*
*Note that, if detaching an entity from a static entity group, you must specify "entitygroup" as the internal ID for the parentID argument (see below).
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_attachrecord&deploy=customdeploy_dsi_attachrecord
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST, PUT
Input
Input fields
Field name | Required | Details |
---|---|---|
childtype | Yes | Record Type of the child record to be attached to the parent |
childid | Yes | Internal ID of the child record to be attached |
parenttype | Yes | Record Type of the parent record for the attached child record |
parentid | Yes | Internal ID of the parent record |
mc_user | No | User name to be recorded in Last DSI User on both records |
role | No | User role field, used only in attaching entity records |
field | No | The field on the child that links to a Custom Record |
detach | No | T if detaching, F by default |
If the POST or PUT methods are used, the body of the request will be JSON; see template below.
Input JSON template
{ "childtype": "", "childid": "", "parenttype": "", "parentid": "", "mc_user": "", "role": "", "field": "", "detach": "" }
Output
The RESTlet returns either a NetSuite error object or the internal ID of the target record to indicate success.
Output JSON template
Success:
{ "success": "" }Error:
{ "error": { "code": "", "message": "" } }
Bin put away task
The Bin Put Away RESTlet uses a RESTful HTTP call to perform the task of moving newly received items into bins.
Important:If Advanced Bins & Lot/Serial Numbers feature is not enabled, the bin record must be associated with the item before put away can occur.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_binputaway&deploy=customdeploy_dsi_binputaway
HTTP headers
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST, PUT
Input
Input fields
Field name | Required | Details |
---|---|---|
location | Yes | The internal id of the NetSuite location (warehouse, store, etc.) where the bins exist |
item | Yes | One or more items in the lines array |
quantity | Yes | For each number in the lines array |
Inventorynumber OR inventorynumberid | Yes | If the item is serialized or lot controlled |
Note:The optional memo field of this record type will only accept 20 characters.
Input JSON template
{ "lookup":"", "location":"", "memo":"", "lines":[{ "item":"", "bins":[{ "binnumber":"", "binid":"", "quantity":"", "inventorynumber":"", "inventorynumberid":"" }] }] }
Output
The RESTlet returns either a NetSuite error object or a JSON object containing an array of the items and quantities that were put away.
Output JSON template
Success:
{ “items": [{ "item": "", "description": "", "quantity": "" }] }Error:
{ "error": { "code": "", "message": "" } }
Download file
The Download File RESTlet uses a RESTful HTTP call to retrieve the contents of a file in the NetSuite file cabinet as well as meta data about the file.
Important:NetSuite only supports downloading file contents up to 10 MB in size.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_downloadfile&deploy=customdeploy_dsi_downloadfile
HTTP headers
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST, PUT
Input
Input fields
If the GET method is used, the values for filename and/or fileid will be in the base URL. https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_downloadfile&deploy=customdeploy_dsi_downloadfile&fileid=&filename=
Field name | Required | Details |
---|---|---|
fileid | Yes | Either fileid or filename is required; if both are supplied fileid takes precedence. |
filename | Yes | Either fileid or filename is required; if both are supplied fileid takes precedence. |
If the POST or PUT methods are used, the body of the request will be JSON.
Input JSON template
{ "fileid": "", "filename": "", }
Output
The RESTlet returns either a NetSuite error object or a JSON object containing the meta data and contents of the file.
Important:NetSuite returns the binary value of non-text file types, such as JPGIMAGE or PDF, as base-64 encoded.
Output JSON template
Success:
{ "fileid": "", "filename": "", "filetype": "", "folderid": "", "encoding":"", "description":"", "url": "", "isonline": "", "data": "" }Error:
ERROR: { "error": { "code": "", "message": "" } }
Get current user info
The Get User Info RESTlet uses a RESTful HTTP call to retrieve meta data about the user making the call.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_getcurentuser&deploy=customdeploy_dsi_getcurentuser
HTTP headers
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET
Input
None
Output
The RESTlet returns either a NetSuite error object or a JSON object containing meta data about the user making this call.
Output JSON template
Success:
{ "internalid": "", "entityid": "", "role": “”, "recordtype": "", "locationId": "", "location": "", "subsidiaryId": "", "subsidiary": "", "now": "10/13/2016 2:15:38 pm", "timezone": "(GMT-08:00) Pacific Time (US & Canada)" }
Error:
{ "error": { "code": "", "message": "" } }
Get configuration
The Get Configuration RESTlet uses a RESTful HTTP call to retrieve all possible configuration settings about the company account.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_getconfiguration&deploy=customdeploy_dsi_getconfiguration&type=
HTTP headers
The authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET
Service Definition
NetSuite_DSI_GetRecord_REST
Input
Optional Fields
The optional "type" field takes one of the available configuration types. If this field is omitted, all types will be returned. Due to the sensitive nature of some of the information returned, the enhanced permissions role is required for "accountingperiods", "taxperiods", and the default return all option.
Available Types by Role
Both Cloud Inventory® Roles:
-
accountingpreferences
-
companyfeatures
-
companyinformation
-
companypreferences
-
userpreferences
Enhanced Permission Role only:
-
accountingperiods
-
taxperiods
-
Report of all Configurations (default)
Output
The RESTlet returns either a NetSuite error object or a JSON object containing one or more objects, one for each kind of configuration.
Output JSON template
Success:
{ "companyinformation": { }, "companypreferences ": { }, "userpreferences": { }, "accountingpreferences": { }, "accountingperiods": { }, "taxperiods": { }, "companyfeatures": { } }Error:
{ "error": { "code": "", "message": "" } }
Get image by item
The Get Image by Item RESTlet uses a RESTful HTTP call to find the Store Display Image, or other requested image field, on the specified item record. This is a specialized version of Download File.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_getimagebyitem&deploy=customdeploy_dsi_getimagebyitem
HTTP headers
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST, PUT
Input
Input fields
Field name | Required | Details |
---|---|---|
internalid | Yes | Either internalid or itemid is required; if both are supplied internalid takes precedence. As always, the internalid option has a faster response time. |
itemid | Yes | Either internalid or itemid is required; if both are supplied internalid takes precedence. As always, the internalid option has a faster response time. |
imagefield | No | Used to specify the field on the item record from which to retrieve the image. It must contain a valid field id, such as storedisplaythumbnail, or be omitted. If omitted the storedisplayimage is returned by default. |
If the GET method is used, the values the parameters will be in the base URL. https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_getimagebyitem&deploy=customdeploy_dsi_getimagebyitem&internalid=&itemid=&imagefield=
If the POST or PUT methods are used, the body of the request will be JSON.
Input JSON template
{ "internalid": "", "itemid": "", "imagefield": "", }
Output
The RESTlet returns either a NetSuite error object or an object containing data about the file, or other optional field, as well as its binary contents.
Important:NetSuite returns the binary value of non-text file types, such as JPGIMAGE or GIFIMAGE, as base-64 encoded.
Output JSON template
Success:
{ "url": "", "internalid": "", "filename": "", "filetype": "", "binary": "[BASE 64 ENCODED]" }Error:
{ "error": { "code": "", "message": "" } }
Get serial numbers
The Get Serial Numbers RESTlet uses a RESTful HTTP call to find all of the serial numbers associated with the specified item.
Base URL
https://rest.na1.system.netsuite.com/app/site/hosting/RESTlet.nl?script=customscript_dsi_getserialnumbers&deploy=customdeploy_dsi_getserialnumbers
HTTP headers
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST
Input
Input fields
Field name | Required | Details |
---|---|---|
itemtype | Yes | NetSuite's type ID for the item to be reallocated. |
itemid | Yes | The number/name of the item to be reallocated or its internal ID. |
iteminternalid | Yes | The number/name of the item to be reallocated or its internal ID. |
Note:The optional memo field of this record type will only accept 20 characters.
Input JSON template
{ "internalid": "", "itemid": "", "location": "", "subsidiary": "", "isonhand": "" }
Output
The RESTlet returns either a NetSuite error object or an array named serialnumberList containing serialnumber objects.
Output JSON template
Success:
{ "serialnumberList": [ { "serialnumber": "" } ] }Error:
{ "error": { "code": "", "message": "" } }
Import CSV
The Import CSV RESTlet uses a RESTful HTTP call to trigger an asynchronus data import to NetSuite. Import CSV is the most commonly used method for transferring small to medium-sized data sets from other applications into NetSuite. The Import CSV process saves time and prevents errors, by submitting data in a CSV (comma-separated value) file. This data can add or update many records at one time, avoiding the need for manual data entry.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_importcsv&deploy=customdeploy_dsi_importcsv
HTTP headers
The authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
POST
Input
Optional Fields
The optional "type" field takes one of the available configuration types. If this field is omitted, all types will be returned. Due to the sensitive nature of some of the information returned, the enhanced permissions role is required for "accountingperiods", "taxperiods", and the default return all option.
Input
Required Fields
The mapping ID and CSV data are required. The data can be provided either as a file in the NetSuite file cabinet or a string in the JSON input to this RESTlet.
-
mapping: The internal ID of a saved CSV import predefined in NetSuite. Please see NetSuite documentation for instructions to set up field mapping.https://system.na1.netsuite.com/app/help/helpcenter.nl?fid=section_N347418.htmlImportant:A transaction is required to have a transaction ID or an external ID as a unique identifier. When importing new transactions, create and specify a unique external ID for each transaction so you do not override NetSuite's auto-numbering.
-
csvFieldid: The internal ID of a CSV file in the NetSuite file cabinet.
-
csvString: The text content of a CSV file to import with the new-line character replaced with a tilde (~).Important:JSON cannot contain back-slash characters or control characters. The CSV string must be condensed to one line with a tilde (~) to indicate where the end of a line would be in a CSV file.
Optional Fields
-
jobName: The name of the import job as it will appear on the Job Status page in the NetSuite UI. Defaults to "DSI Import CSV."
Input JSON template
{ "mapping": "", "csvString": "", "csvFileid": "", "jobName": "" }
Output
The RESTlet returns either a NetSuite error object or a JSON object containing the internal ID of the new import job created in NetSuite's work queue (which is also the identifier for the CSV response file).
Output JSON template
Success:
{ "jobId ": " " }Error:
{ "error": { "code": "", "message": "" } }
List all locations
The List All Locations RESTlet uses a RESTful HTTP call to retrieve meta data about the user making the call.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_getcurentuser&deploy=customdeploy_dsi_getcurentuser
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET
Input
None
Output
The RESTlet returns either a NetSuite error object or a JSON object containing an array of locations with some meta-data about each. Locations marked inactive are not returned.
Output JSON template
Success:
{ "locationList": [ { "name": "", "internalid": "", "tranprefix": "", "address": "", "city": "", "state": "", "zip": "", "country": "" }] }Error:
{ "error": { "code": "", "message": "" } }
List all subsidiaries
The List All Subsidiaries RESTlet uses a RESTful HTTP call to retrieve a list of all active subsidiaries in a NetSuite One World account.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_listallsubsidiaries&deploy=customdeploy_dsi_ listallsubsidiaries
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST
Input
None
Output
The RESTlet returns either a NetSuite error object or a JSON object containing an array of subsidiaries with some meta-data about each. Subsidiaries marked inactive are not returned.
Output JSON template
Success:
{ "subsidiaryList": [ { "name": "", "internalid": "", "tranprefix": "", "address": "", "city": "", "state": "", "zip": "", "country": "" }] }Error:
{ "error": { "code": "", "message": "" } }
Reallocate item task
The Reallocate Item RESTlet uses a RESTful HTTP call to perform the task of reallocating the committed quantities of an item across unfulfilled Sales or Transfer Orders.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_task_reallocateitem&deploy=customdeploy_dsi_task_reallocateitem
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST, PUT
Input
Input fields
Field name | Required | Details |
---|---|---|
internalid | Yes | Either internalid or itemid is required; if both are supplied internalid takes precedence. As always, the internalid option has a faster response time. |
itemid | Yes | Either internalid or itemid is required; if both are supplied internalid takes precedence. As always, the internalid option has a faster response time. |
mc_user | No | User name of currently logged in Mobile Client user. |
location | No | Interalid ID of the location for the orders to be reallocated (multilocation only). |
subsidiary | No | Interalid ID of the subsidiary for the orders to be reallocated (NetSuite One World only). |
Input array: target This is an array of one or more orders which need to have the item allocated to them. |
Yes |
|
Input array: source This is an array of one or more orders from which the item will be deallodated. |
Yes |
|
Note:The optional memo field of this record type will only accept 20 characters.
Input JSON template
{ "mc_user": "", "iteminternalid": "", "itemid": "", "itemtype": "“, "location": "", "subsidiary": "", "target": [{ "internalid": "", "tranid": "", "recordtype": "" }], "source": [{ "internalid": "", "tranid": "", "recordtype": "" }] }
Output
The RESTlet returns either a NetSuite error object or two arrays containing the internal ids of the sources and targets to indicate success.
Output JSON template
Success:
{ "sources": [{ "internalid": "" }], "targets": [{ "internalid": "" }] }Error:
{ "error": { "code": "", "message": "" } }
Record create
The Record Create RESTlet uses a RESTful HTTP create one or more NetSuite records and initialize its fields with data specified in the call.
Base URL
https://rest.na1.system.netsuite.com/app/site/hosting/RESTlet.nl?script=customscript_dsi_recordcreate&deploy=customdeploy_dsi_recordcreate
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
POST, PUT
Input
Input fields
Field name | Required | Details |
---|---|---|
recordcategory | Yes | Record category |
Name field:
|
No | Will override NetSuite's automatic numbering if specified. |
Input array: create | Yes | Contains data to initialize the new record. |
Input array: targetfields | No | An array of fieldid - value pairs to allow initialization of fields (no sub-lists or sub-records) not specified elsewhere. |
Input array: initvalues | No | An array of fieldid - value pairs. This is for some rare cases when records require data in their initialization. Example: Billing Schedule |
Input array: lines |
No | Used only for the item sub-list at this time. |
Input JSON template
{ "recordcategory": "", "create": [{ "mc_user": "", "recordtype": "", "tranid": "", "itemid": "", "entityid": "", "location": "", "transferlocation": "", "account":"", "subsidiary":"", "sublists": [{ "sublistid": "", "subrecordname":"", "lines": [{ “junk”:”MEP bug work around”, "nvpair": [{ "columnid": "", "newvalue": "" }], "inventorydetail": { "location":"", "tolocation":"", "quantity": "", "unit": "", "inventoryassignment": [{ "line": "", "binnumber": "", "binid": "", "tobinnumber": "", "tobinid": "", "quantity": "", "inventorynumber": "", "inventorynumberid": "", "expirationdate":"" }] } }] }], "initvalues": [{ "fieldid": "", "value": "" }], "targetfields": [{ "fieldid": "", "value": "", "text": "" } ,{ "inventorydetail": { "item":"", "unit": "", "inventoryassignment": [{ "line": "", "binnumber": "", "binid": "", "quantity": "", "inventorynumber": "", "inventorynumberid": "" },{ "line": "", "binnumber": "", "binid": "", "quantity": "", "inventorynumber": "", "inventorynumberid": "" }] } }], "matrix": { "matrixid": "", "lines": [{ "row": "", "column": "", "nvpair": [{ "columnid": "", "newvalue": "" }] }] }, "pricematrix": [{ "row": "", "column": "", "currencyid": "", "newprice": "" }] }] }
Output
The RESTlet returns two arrays named success and fail. The array, success, is an array of record objects, containing all their non-null fields. The array, fail, is an array of NetSuite error objects with an index to indicate which of the input records, from the create array, failed.
Output JSON template
{ "success": [{ Full record object of the record just created }], "fail": [{ "index": "", "code": "", "message": "" }] }
Record delete
The Record Delete RESTlet uses a RESTful HTTP call to find one NetSuite record and delete it from NetSuite's database. Use this RESTlet with caution as the deletion cannot be undone.
Base URL
https://rest.na1.system.netsuite.com/app/site/hosting/RESTlet.nl?script=customscript_dsi_recorddelete&deploy=customdeploy_dsi_recorddelete
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, DELETE
Input
Input fields
Field name | Required | Details |
---|---|---|
recordtype | Yes | Record type |
internalid | Yes | Either internalid or a name field (tranid, entityid, itemid). As always, the internalid option has a faster response time. |
Name field: tranid, entityid, itemid | Yes | Either internalid or a name field (tranid, entityid, itemid). As always, the internalid option has a faster response time. |
Input JSON template
{ "internalid": "", "recordtype": "", "tranid": "", "itemid": "", "entityid": "" }
Output
In accordance with NetSuite requirements, the RESTlet returns nothing upon a successful deletion; or a NetSuite error object if the deletion was not successful.
Output JSON template
{ "error": { "code": "", "message": "" } }
Record lookup
The Record Lookup RESTlet uses a RESTful HTTP call to find and return data stored in one or more NetSuite records.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/RESTlet.nl?script=customscript_dsi_rh_recordlookup&deploy=customdeploy_dsi_rh_recordlookup
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST
Input
Input fields
Field name | Required | Details |
---|---|---|
recordtype | Yes | Record type |
internalid | Yes | Either internalid or name field ( tranid, entityid, itemid ) or search object(s) are required. |
Search objects: | Yes | Either internalid or name field ( tranid, entityid, itemid ) or search object(s) are required. Body field criteria are specified in the searchfields object and sub-list fields are specified in the searchcolumns object; both may be present in the same call. The searchvalue field can contain either a string or an array of strings (using single quotes e.g. "searchvalue": "['672', '678']"). |
includeinvnumber | No | If Advanced Lot/Serial numbers are desired from an item search, the field includeinvnumber must be set to “T”. |
includeinactive | No | By default, inactive records are not returned. To return inactive records, the field includeinactive must be set to “T”. |
includeitemrecord | No | If additional information about each item on a transaction is needed, the field includeitemrecord must be set to “T”. This will insert the entire item record on each item line. Caution:Use this feature only when necessary as it significantly reduces performance. |
Special exception
The generic recordtype, “item”, can be used when searching for any type of item by its UPC; i.e. the upccode field is a fieldid in the searchfields array. This is only possible because of the uniqueness of UPC codes. All other item searches require the full item type (ex: inventoryitem, assemblyitem, etc).
Input JSON template
{ "internalid": "", "recordtype": "", "tranid": "", "itemid": "", "entityid": "", "includeinactive": "", "includeitemrecord":"", "includeinvnumbers":"", "searchfields": [{ "fieldid": "", "operator": "", "searchvalue": "", "inventorydetail": { "unit": "", "inventoryassignment": [{ "binnumber": "", "inventorynumber": "" }] } }], "searchcolumns": [{ "join": "", "fieldid": "", "operator":"", "searchvalue": "", "inventorynumber":"", "inventorynumberid":"" }] }
Note: Searching for a transaction with specific item in its item list, by id, requires a fieldid of “internalid”, not “item.”
"searchcolumns": [{ "join": "item", "fieldid": "internalid", "operator":"", "searchvalue": "672", "inventorynumber":"", "inventorynumberid":"" }
Output
The RESTlet returns an array of one or more records that match the criteria containing all fields from that record that have a non-null value; or a NetSuite error object. The array name reflects the category of the record type: transaction, entity, item, or simply RECORD for custom types.
Output JSON template
Transaction:
{ "transaction": [{ Full record object of the record found }], }
Entity:
{ "entity": [{ Full record object of the record found }], }
Item:
{ "item": [{ Full record object of the record found }], }
Other records or custom records:
{ "RECORD": [{ Full record object of the record found }], }
Error:
{ "error": { "code": "", "message": "" } }
Record mass update
The Record Mass Update RESTlet uses a RESTful HTTP call to find one or more NetSuite records and make identical changes to each one
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_recordmassupdate&deploy=customdeploy_dsi_recordmassupdate
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST
Input
Input fields
Field name | Required | Details |
---|---|---|
recordtype | Yes | Record type |
search object | Yes | One or more search objects are required. Body field search criteria are specified in the searchfields object and sub-list field criteria are specified in the searchcolumns object; both may be present in the same call. The searchvalue field can contain either a string or an array of strings (using single quotes e.g. "searchvalue": "['672', '678']"). |
update object | Yes | One or more update objects are required. Body field updates are specified in the updatefields object, sub-list field updates are specified in the updatecolumns object and item price updates in the pricematrix object.
datetype: This field, in the updatefields objects and the updatecolumns -> lines -> nvpair objects, indicates a date field is being updated and specifies the type of field. Valid values are: “date” and “datetime”. Date/time values are formatted dd/mm/yyyy[space]hh:mm[space]am/pm with no leading zeros. |
mc_user | No | Used to record the user identity, usually an email address, of the user currently logged into mobile client. |
includeinactive | No | By default, inactive records are not updated. To update inactive records, the field includeinactive must be set to “T”. |
Special Exception: The generic recordtype, “item”, can be used when searching for any type of item.
Input JSON template
{ "recordtype": "", "mc_user": " ", "includeinactive": "", "filterexpression":"", "searchfields": [{ "fieldid": "", "operator": "", "searchvalue": "" }], "searchcolumns": [{ "join": "", "fieldid": "", "operator":"", "searchvalue": "", "inventorynumber":"" }], "updatefields": [{ "fieldid": "", "newvalue": "", "datetype":"" }], "updatecolumns": [{ "sublistid": "", "subrecordname":"", "lines": [{ "line": "", "remove": "", "nvpair": [{ "columnid": "", "newvalue": "", "datetype":"" }], "inventorydetail": { "item":"", "location":"", "tolocation":"", "quantity": "", "unit": "", "inventoryassignment": [{ "line": "", "binnumber": "", "binid": "", "tobinnumber": "", "tobinid": "", "quantity": "", "inventorynumber": "", "inventorynumberid": "", "expirationdate":"" }] } }] }], "pricematrix": [{ "row": "", "column": "", "currencyid": "", "newprice": "" }] }
Note: Searching for a transaction with specific item in its item list, by id, requires a fieldid of “internalid”, not “item.”
"searchcolumns": [{ "join": "item", "fieldid": "internalid", "operator":"", "searchvalue": "672", "inventorynumber":"", "inventorynumberid":"" }
Output
The RESTlet returns an array of one or more internal ids of the records that were updated. match the criteria containing all fields from that record that have a non-null value; or a NetSuite error object. The array name reflects the category of the record type: transaction, entity, item, or simply RECORD for custom types.
Output JSON template
Success:
{ "success": [ "internalid": "", "id": "" ]}
Error:
{ "error": { "code": "", "message": "" } }
Record print
The Record Print RESTlet uses a RESTful HTTP call to trigger NetSuite's print processing and return the results in PDF format.
Only transactions are supported in NetSuite's print functionality.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_recordprint&deploy=customdeploy_dsi_recordprint
HTTP headers
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST
Input
Input fields
Field name | Required | Details |
---|---|---|
type | Yes | Possible values are TRANSACTION, STATEMENT, PACKINGSLIP, PICKINGTICKET, BILLOFMATERIAL |
internalid | Yes | The transaction must be specified in either the internalid or both recordtype and tranid fields. |
recordtype | Yes | The transaction must be specified in either the internalid or both recordtype and tranid fields. |
tranid | Yes | The transaction must be specified in either the internalid or both recordtype and tranid fields. |
formnumber | Yes | The formnumber field is required for all types except TRANSACTION, which will use the default (preferred) form if left blank. |
startdate | No | Inside the statement object, the fields startdate, statementdate and openonly will filter the data for printing a STATEMENT type. |
statementdate | No | Inside the statement object, the fields startdate, statementdate and openonly will filter the data for printing a STATEMENT type. |
openonly | No | Inside the statement object, the fields startdate, statementdate and openonly will filter the data for printing a STATEMENT type. |
shipgroup | No | Inside the pickingticket object, the fields shipgroup and location will filter the data for printing a PICKINGTICKET type. |
location | No | Inside the pickingticket object, the fields shipgroup and location will filter the data for printing a PICKINGTICKET type. |
Input JSON template
{ "internalid": "", "type": "", "tranid": "", "recordtype": "", "formnumber": "", "statement": { "startdate": "", "statementdate": "", "openonly": "" }, "pickingticket": { "shipgroup": "", "location": "" } }
Output
The RESTlet returns either a NetSuite error object or the Base64 encoded PDF file.
Output JSON template
Success:
{ "pdfdata": "BASE 64 ENCODED PDF" }Error:
{ "error": { "code": "", "message": "" } }
Record transform
Some NetSuite records, most notably Item Fulfillment and Item Receipt, can only be created by transforming an existing record.
The transform operation will create the proper cross-links and initialize the fields of the new record with data from the transformed (source) record.
Base URL
https://rest.na1.system.netsuite.com/app/site/hosting/RESTlet.nl?script=customscript_ dsi_transactiontransform &deploy=customdeploy_ dsi_transactiontransform
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
POST, PUT
Input
Input fields
The input for this RESTlet is contained within an array, named transform , where each element of the array is the structure to transform one record.
Field name | Required | Details |
---|---|---|
fromrecordtype | Yes | |
fromrecordid | Yes | |
torecordid | Yes | |
tolocation | Yes | Required if the Multi-location feature is enabled |
mc_user | No | Used to record the username of the currently logged-in Mobile Client use . |
pps | No | Used to specify “picked”, “packed”, or “shipped” and will set the document status of a newly created Item Fulfillment accordingly. |
Input arrays:
Array | Required | Details |
---|---|---|
targetfields | No | The array targetfields is an array of fieldid - value pairs to allow initialization of body fields on the new record (not sub-lists or sub-records) not specified elsewhere. |
sourcefields | No | The array sourcefields is an array of fieldid - value pairs to allow setting body fields on the transformed (source) record after the new record has been created. |
lines | No | The array lines is an array of item lines. Specify the line number on the source record (counting from 1) the item internalid and quantity to receive (both fields required). Each line can have an nvpair array to allow setting of other line (column) fields. |
If no item on any line has Inventory Details (Advanced Bins & Lot/Serial Number) you may fully receive all lines by omitting the lines array. |
||
To receive or fulfill a line that has Inventory Details (Advanced Bins & Lot/Serial Number), you must include the inventorydetail structure in addition to the usual line fields. |
Note: Do not attempt to fulfill/receive a line for zero quantity. Simply omit such a line from the call. This does NOT apply to transforms other than receiving or fulfilling.
Input JSON template
{ "transform": [{ "mc_user": "", "fromrecordtype": "", "fromrecordid": "", "torecordtype": "", "tolocation": "", "location": "", "pps": "", "sourcefields": [{ "fieldid": "", "value": "" }], "targetfields": [{ "fieldid": "", "value": "" } ,{ "inventorydetail": { "item":"", "unit": "", "inventoryassignment": [{ "line": "", "binnumber": "", "binid": "", "quantity": "", "inventorynumber": "", "inventorynumberid": "" }] } }], "sublists": [{ "sublistid": "", "subrecordname":"", "lines": [{ "linenum": "", "item": "", "qty": "", "binnumbers": "", "serialnumbers": "", "refnum":"", "nvpair": [{ "columnid": "", "value": "" }], "inventorydetail": { "item": "", "barcode": "", "location": "", "tolocation": "", "quantity": "", "unit": "", "inventoryassignment": [{ "binnumber": "", "binid": "", "tobinnumber": "", "tobinid": "", "quantity": "", "inventorynumber": "", "inventorynumberid": "", "expirationdate": "" }] } }] }] }] }
Output
The RESTlet returns two arrays named success and fail. The success array is an array of objects for each successful operation containing the newinternalid field. The array fail is an array of NetSuite error objects with an index to indicate which of the input records from the create array failed.
Output JSON template
{ "success": [ { "newinternalid": "" } ], "fail": [{ "index": "", "code": "", "message": "" }] }
Record update
The Record Update RESTlet uses a RESTful HTTP call to find one NetSuite record and update one or more fields.
Base URL
https://rest.na1.system.netsuite.com/app/site/hosting/RESTlet.nl?script=customscript_dsi_recordupdate&deploy=customdeploy_dsi_recordupdate
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
POST, PUT
Input
Input fields
Field name | Required | Details |
---|---|---|
recordtype | Yes | Record type |
internalid | Yes | The recordtype field is required and either internalid or name field (tranid, entityid, itemid). As always, the internalid option has a faster response time. |
name field | Yes | The recordtype field is required and either internalid or name field (tranid, entityid, itemid). As always, the internalid option has a faster response time. |
mc_user | No | Used to record the user identity, usually an email address, of the user currently logged into mobile client. If left blank, it will remove previous data. |
Other body field criteria are specified in the updatefields object, sub-list fields are specified in the updatecolumns object and prices in the pricematrix object.
Input arrays:
Fields to be updated are specified by one or more of the following arrays of objects; any or all may be present in the same call.
Array | Details |
---|---|
updatefields | Body fields to be modified are specified by the updatefields array which contains fieldid-newvalue pairs. |
updatecolumns | Sublist lines to be modified are specified by the updatecolumns array which contains sublistid (usually item) and the lines array. The lines array consists of line (line number counted from one) and the nvpair array of columnid-newvalue pairs and a remove field. Sublist lines also have special functions:
|
pricematrix | Prices to be modified are specified by the pricematrix array which contains newprice, the currencyid (defaults to 1 if multiple currency is enabled), row (required if multi price is enabled) and column (required if quantity pricing is enabled) Row and Column correspond to the rows and columns (ignoring the default discount column) of the price matrix on the item record. |
Input JSON template
{ "internalid": "", "recordtype": "", "tranid": "", "entityid": "", "itemid": "", "mc_user": "", "updatefields": [{ "fieldid": "", "newvalue": "" }], "updatecolumns": [{ "sublistid": "", "subrecordname":"", "lines": [{ "line": "", "remove": "", "nvpair": [{ "columnid": "", "newvalue": "" }], "inventorydetail": { "item":"", "location":"", "tolocation":"", "quantity": "", "unit": "", "inventoryassignment": [{ "line": "", "binnumber": "", "binid": "", "tobinnumber": "", "tobinid": "", "quantity": "", "inventorynumber": "", "inventorynumberid": "", "expirationdate":"" }] } }] }], "pricematrix": [{ "row": "", "column": "", "currencyid": "", "newprice": "" }] }
Output
The RESTlet returns the internal id of the record that was updated; or a NetSuite error object.
Output JSON template
Success:
{ "internalid": "", "id": "" }
Error:
{ "error": { "code": "", "message": "" } }
Approvals
Many approval fields are part of the NetSuite Approvals Workflow (bundle 10983). That bundle must be installed to use these field.
List of approvals that can be done with DSI_RecordUpdate. Use the nvpair of the updatefields array.
-
Employee Commission - (accountingapproval: T)
-
Expense Report - (accountingapproval: T and/or supervisorapproval: T)
-
Invoice – (approvalstatus: 2)
-
Journal Entry - (approved: T)
-
Purchase Order - (orderstatus: B)
-
Return Authorization - (orderstatus: B)
-
Sales Order - (orderstatus: B)
-
Transfer Order - (orderstatus: B) (note, TrnfrOrd:C depreciated)
-
Time Bill - (supervisorapproval: T)
-
Work Order - (orderstatus: B)
Run search
The Run Search RESTlet uses a RESTful HTTP call to run a search, either an ad hoc search or a saved search which exists on the NetSuite account.
This RESTlet is intended for advanced users with knowledge of NetSuite searches, record IDs and field IDs. Much of the needed information can be found in the Records Browser.
Base URL
https://rest.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_runsearch&deploy=customdeploy_dsi_runsearch
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST, PUT
Ad hoc search
An ad hoc search can be run with just a record type without filters and/or columns. With no columns, the search will return just the internalid and recordtype of each result sorted by internalid. With no filter, the search will attempt to return all records of that type (up to 32,000 result lines).
Saved search
When calling a saved search, any filters or columns defined in the call are added to the filters and columns of the saved search. The restlet cannot remove filters or columns from a saved search.
Important:For both ad-hoc and saved searches, the user must have permission to view the record type being searched. The user running the RESTlet must also have permission to view the saved search, i.e. the user is included in the Audience. Attempting to perform a search without permissions throws: “INVALID_SEARCH. That search or mass update does not exist.”
Input
Field name | Required | Details |
---|---|---|
searchtype | Yes | The NetSuite Search Type ID. This is usually “transaction”, “item”, “entity” or the Record Type ID of the records to be searched. |
searchid | No | The ID or internalid of a saved search. |
searchcolumns | No | To add a result column, use the searchcolumns array to define one or more result columns.
|
searchfilters | No | To add a filter, use the searchfilters array to define one or more filters.
Helpful tip: For transaction searches, use the “mainline” is “T” filter to get only header information; or, use “mainline” is “F” to get only detail lines
|
filterexpression | No | A filter expression allows the restlet to include additional logical operators, such as OR and NOT, and SQL formulas. If a filter expression is specified, any searchfilters will be ignored. For more details about filter expressions, see the appendix Search Filter Expression. Note: A filter expression must use single quotes (‘) around strings, not double (“); AND it cannot contain any control characters such as tab or new line (enter). |
loadrecords | No | To force this RESTlet to return full records like DSI_RecordLookup, set loadrecords to “T”. Use with extreme caution, this option severely reduces performance and can easily exceed NetSuite governance limits. This option not available for csv/pdf download. |
sortedbyinternalid | No | In order to return more than 1000 results, the search must be sorted by internalid. When the sortedbyinternalid field is equal to “F”, it prevents the restlet from attempting to search beyond 1000 results which could have unexpected results. When sortedbyinternalid is not “F”, the RESTlet has a hard limit of 32,000 results |
containsjson | No | If any returned fields contain JSON, set containsjson to “T”. This will to trigger JSON parsing to make the contents of the text field JSON accessible from MEP. By default, NetSuite adds back-slash escape characters to any JSON found in a text field |
filetype | No | To generate a CSV or PDF file from the search results, set filetype to “csv” or “pdf ".
Important: If a file with the same filename and folder exists, it will be overwritten. |
Input JSON template
{ "searchtype": "", "searchid": "", "sortedbyinternalid":"", "loadrecords":"", "containsjson":"", "filetype":"", "savefile":"", "filename":"", "folderid":"", "filterexpression":"", "searchfilters": [{ "fieldid": "", "operator": "", "searchvalue": "", "searchvalue2": "", "join": "" }], "searchcolumns": [{ "fieldid": "", "join": "", "text":"", "summary":"" }] }
Output
The RESTlet returns either a NetSuite error object or an array name serialnumberList containing serialnumber objects.
Output JSON template
Success Saved Search:
{ "RESULTS": [{ The full search results object defined by the Results sub-tab of the saved search. }], }
Success Ad Hoc Search:
{ "RESULTS": [{ "id": "", "recordtype": "", "columns": { "": "", "": "" }, "internalid": { "name": "", "internalid": "" } }] }
Success When Generating a CVS/PDF:
{ "RESULTS": [{ "file": { "fileid":"", "filename": "", "filesize": "", "folderid": "", "encoding": "", "isonline": “” }, "csvdata": "BASE 64 ENCODED", "pdfdata": "BASE 64 ENCODED" }] }Error:
{ "error": { "code": "", "message": "" } }
Transaction email
The Transaction Email RESTlet uses a RESTful HTTP call to create an email, attach a PDF of a transaction, and send the email through NetSuite and attach a link to the email to the transaction.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_transactionemail&deploy=customdeploy_dsi_transactionemail
HTTP headers
The authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST, PUT
Input
Optional Fields
The optional "type" field takes one of the available configuration types. If this field is omitted, all types will be returned. Due to the sensitive nature of some of the information returned, the enhanced permissions role is required for "accountingperiods", "taxperiods", and the default return all option.
Input
Required Fields
-
author - The internal ID of the sender's employee record.Note:The employee record must have an email address.
-
recipient - A single internal ID of a NetSuite entity (employee, customer, etc.).Note:With this option, the message is automatically attached to the entity record.
-
recipientemail - If recipient is blank, either a single email address or a list of up to 10 comma-separated email addresses is required.
-
subject - Subject of the outgoing email.
-
body - Body of the outgoing email. It can contain plain text or HTML (replace all double quotes with a single quote).
-
transaction object - The transaction to be printed and emailed. See Record Print for the required fields.
Optional Fields
-
cc - carbon copyA single email address, (example "cc": "me@domain.com",) orAn array of email addresses (example "cc": [me@domain.com","you@domain.com"]Important:DO NOT INCLUDE EMPTY STRINGS IN THE ARRAY.
-
bcc - blind carbon copyA single email address, (example "bcc": "me@domain.com",) orAn array of email addresses (example "bcc": [me@domain.com","you@domain.com"]Important:DO NOT INCLUDE EMPTY STRINGS IN THE ARRAY.
-
replyto - A single email address
-
fileattachments - An array of internal ID value pairs containing the filecabinet IDs or other files to attach to the email.
-
transaction - An object containing information about the transaction to print and email. This object is identical to the input to the Record Print restlet.
Input JSON template
{ "recipient": "", "recipientemail": "", "author": "", "subject": "", "message": "", "cc": "", "bcc": "", "replyto":"", "fileattachments": [{ "internalid": "" }], "transaction": { "internalid": "", "type": "", "tranid": "", "recordtype": "", "formnumber": "", "filename": "", "folderid": "", "statement": { "startdate": "", "statementdate": "", "openonly": "" }, "pickingticket": { "shipgroup": "", "location": "" }, "packingslip": { "itemfulfillment": "" } } }
Output
The RESTlet either outputs a single field named "success" with the value "true", or a NetSuite error object.
Output JSON template
Success:
{ "success": "true" }Error:
{ "error": { "code": "", "message": "" } }
Upload file
The Upload File RESTlet uses a RESTful HTTP call to upload a file to NetSuite's file cabinet and optionally attach it to another record. The RESTlet will return the internal ID, name, URL, and file size of the new file.
A special version for images of this RESTlet also exists. This version will allow only image file types and, if requested to attach to an item record, will set the image as the item's Item Display Image (storedisplayimage). The input and output interfaces are identical.
Base URL
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_uploadfile&deploy=customdeploy_dsi_uploadfile
or
https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_dsi_uploadimage&deploy=customdeploy_dsi_uploadimage
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
POST, PUT
Input
Input fields
Field name | Required | Details |
---|---|---|
filetype | Yes | The NetSuite File Type ID of the file to be uploaded. See Supported File Types for a complete list. |
data | Yes | The contents of the file. This can be either be text or base 64 encoded binary. |
mc_user | No | User name of currently logged in Mobile Client user. |
filename | No | Name of the file in the file cabinet. If not provided, a random numeric name will be generated. |
filefolder | No | The internal ID of the desired folder in the file cabinet. Defaults to -4 (NetSuite default Images folder. |
description | No | Text to describe the file. |
requirelogin | No | The value “T” will prevent access unless logged into NetSuite. Defaults to “F”. |
attachto | No | The internal ID of a record. A link to the new file will appear in the Files subtab. |
attachtype | No | A valid NetSuite record type ID. The record type of the record specified in attachto. |
Note: NetSuite does not support the creation of non-text file types, such as JPGIMAGE or PDF, unless the data content is base-64 encoded.
Input JSON template
{ "mc_user": "", "filename": "", "filetype": "", "filefolder": "", "attachto": "", "attachtype": "", "description": "", "requirelogin": "", "data": "[TEXT or BASE 64 ENCODED]" }
Output
The RESTlet returns either a NetSuite error object or an array named serialnumberList containing. serialnumber objects.
Output JSON template
Success:
{ "internalid": "", "url": "", "size": "", "name": "" }
Error:
{ "error": { "code": "", "message": "" } }
Void transaction
The Get Serial Numbers RESTlet uses a RESTful HTTP call to void, or cancel, a transaction that has not been processed. If transactions linked to this transaction exist, it cannot be voided .
When you void a transaction, its total and all its line items are set to zero, but the transaction is not removed from the system.
Base URL
https://rest.na1.system.netsuite.com/app/site/hosting/RESTlet.nl?script=customscript_dsi_transactionvoid&deploy=customdeploy_dsi_transactionvoid
HTTP headers
The Authorization header is only needed if Token Based Authentication is not being used.
Authorization
NLAuth nlauth_account=*******, nlauth_email=******, nlauth_signature=******, nlauth_role=****
Content
application
Type
json
Methods supported
GET, POST, PUT
Input
Input fields
Field name | Required | Details |
---|---|---|
internalid | Yes | |
recordtype | Yes | Either recordtype or tranid of the transaction to be voided are required. |
tranid | Yes | Either recordtype or tranid of the transaction to be voided are required. |
Input JSON template
{ "mc_user": "", "tranid":"", "internalid": "", "recordtype": "" }
Output
The RESTlet returns either a NetSuite error object or an internal id and void type. NetSuite supports two types of voids: direct voids and voids by reversing journal. The field voidtype will take the value “direct” or “journal”. The internalid field will return either the internal id of the new journal entry or the internal id of the voided transaction.
Output JSON template
Success:
{ "voidtype": "", "internalid": "" }
Error:
{ "error": { "code": "", "message": "" } }
Loading...
There was a problem loading this topic