In NetSuite, REST APIs are used for integrating and interacting with NetSuite data and functionalities programmatically. REST APIs provide a flexible, lightweight way to connect external applications, services, and systems with NetSuite, enabling automation, data exchange, and extended capabilities. This includes processes such as e-commerce integrations where an online store can use REST APIs to sync orders, customers, and inventory levels between NetSuite and the e-commerce platform.
Changes in these data are also communicated with NetSuite via REST API. However, some users get an issue wherein modifying an existing line in a sublist causes a new line to be added instead. To make sure that the intended line is updated, the line tag must be added within the sublist’s items array for the system to correctly identify the line.
In the example below, the first item of an existing sales order’s quantity is changed from 1 to 15 using PATCH Operation with REST API.
{
"item":{
"items":[{
"line":1,
"quantity":15
}]
}
}
Before Update:
After Update:
System Notes reflecting the change in total amount that is caused by the change in quantity:
The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Oracle + NetSuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Oracle + NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Oracle + NetSuite Inc. shall not be liable for any direct, indirect, or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
—
Have you got any feedback? Let us know in the comments!