New Attach and Detach Operations in REST Web Services

Discover new attach and detach operations for defining relationships between records in NetSuite's REST web services.

·2 min read·2 views·View Oracle Docs

The new attach and detach operations in NetSuite's REST web services allow developers to define or remove relationships between two record instances. For instance, you can now associate a contact record with a partner record or a file record with an opportunity record, enhancing the integration capabilities.

How Do Attach and Detach Operations Work?

To attach or detach records, users must specify the record type and IDs in the request. The typical format for such operations uses the special action identifiers, !attach and !detach. As of now, these operations are limited to contact and file records only.

Example of Attaching a Record

Here’s how to attach a contact record instance to a customer record instance:

http
1POST .../services/rest/record/v1/customer/660/!attach/contact/106
2
3Content-Type: application/json
4{
5 "role": {
6 "id": "-10"
7 }
8}

This example shows the inclusion of an optional role attribute, though the request body can also be empty if there are no optional attributes to set.

Example of Attaching a File Record

To attach a file record to an opportunity record, you would use:

http
POST .../services/rest/record/v1/opportunity/379/!attach/file/398
Content-Type: application/json
{}

Key Considerations

  • Only contact and file records can be attached or detached using this operation.
  • This functionality streamlines the process of managing relationships within your NetSuite account, improving data consistency and usability.

Who This Affects

  • Developers: Key enhancements for REST API integrations.
  • Administrators: Improved ability to manage records and relationships dynamically through the API.

By effectively utilizing these attach and detach operations, developers can create more robust integrations, enhancing how record interactions are handled within NetSuite.

Key Takeaways

  • New attach and detach operations allow defining or removing record relationships.
  • Currently applicable only for contact and file records.
  • Enhances the integration capabilities of your NetSuite instance, enabling more dynamic data management.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

Are the new attach and detach operations available for all records in NetSuite?
No, the new attach and detach operations are currently limited to contact and file records.
Do I need to modify the request body when attaching a contact with a specific role?
Yes, when attaching a contact with a specific role, you should include the 'role' attribute in the JSON request body.
Can I use external IDs with the attach and detach operations in REST Web Services?
Yes, these operations support external IDs, providing flexibility in managing relationships with external systems.
What URL pattern is used for attach and detach operations in REST Web Services?
The URL pattern is /services/rest/record/v1/{recordType}/{recordId}/!{operation}/{relatedRecordType}/{relatedRecordId}. Replace '{operation}' with '!attach' or '!detach' to perform the respective action.

Weekly Update History (1)

SuiteTalk Web Servicesupdated

Updated 2025.2 SOAP Schema Browser that the 2025.2 SOAP Schema Browser is now available.

View Oracle Docs
Source: New Attach and Detach Operations in REST Web Services Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in REST Web Services

View all REST Web Services articles →