Connection Object Members Management in SuiteScript

The Connection Object Members in SuiteScript facilitate file management on SFTP servers via methods for uploading, downloading, and directory management.

·3 min read·View Oracle Docs

The Connection Object Members in SuiteScript enable developers to efficiently manage file transfers and directories on SFTP servers. Using the N/sftp module, these methods cover various functionalities like uploading, downloading, and organizing files in a remote directory.

What Are Connection Object Members?

The Connection Object Members are methods and enumerations you can call on the sftp.Connection object within the N/sftp module. These members allow you to interact with an SFTP server programmatically, providing a streamlined approach to file management.

Key Functionalities of Connection Object Members

The following methods are available on the sftp.Connection object:

Member TypeNameReturn Type / Value TypeSupported Script TypesDescription
MethodConnection.download(options)file.FileServer scriptsDownloads a file from the remote FTP server.
MethodConnection.upload(options)voidServer scriptsUploads a file to the remote FTP server.
MethodConnection.makeDirectory(options)stringServer scriptsCreates an empty directory.
MethodConnection.removeDirectory(options)voidServer scriptsRemoves an empty directory.
MethodConnection.removeFile(options)voidServer scriptsRemoves a file in a directory.
MethodConnection.move(options)voidServer scriptsMoves a file or directory from one location to another.
MethodConnection.list(options)Array<Object>Server scriptsLists items in the remote directory.
EnumConnection.MAX_FILE_SIZEenumServer scriptsHolds the values for the maximum file size.
EnumConnection.MAX_TRANSFER_TIMEOUTenumServer scriptsHolds the values for the maximum transfer timeout.

Important Notes on Using Connection Object Members

  • Escaping Wildcards: All paths, directories, and filenames with wildcards like ? and * must have those characters escaped unless they are specifically intended to function as wildcards. This is crucial for ensuring accurate file operation commands.
  • SSH Key Requirements: Establish an SFTP connection using SSH keys. These keys must be uploaded through NetSuite's secure interface, capturing necessary permissions. For key management tasks, refer to the N/keyControl module for effective handling.

Related Functionalities

While the Connection Object Members focus on file management, other aspects of SFTP in NetSuite can be achieved using:

  • RESTlets: For data transfer without SFTP, RESTlets can manage file uploads and downloads.
  • SOAP Web Services: These allow CRUD operations on file records, facilitating direct interaction with the File Cabinet.

Conclusion

The Connection Object Members in SuiteScript provide a structured method for managing SFTP file operations with methods for uploading, downloading, and directory management, making file interactions programmatically efficient.

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

Key Takeaways

  • Connection Object Members simplify SFTP operations such as upload/download.
  • Escaping wildcards is necessary for file path accuracy.
  • SSH keys are required for secure SFTP connections and must be managed through NetSuite.
  • RESTlets and SOAP Web Services offer alternatives for file operations without SFTP.

Frequently Asked Questions (4)

Which script types support the methods on the sftp.Connection object?
The methods on the sftp.Connection object are supported by server scripts.
Do I need to upload SSH keys separately when using Connection Object Members?
Yes, SSH keys must be uploaded through NetSuite's secure interface for establishing an SFTP connection.
How should I handle wildcards in file paths when using Connection Object Members?
All paths, directories, and filenames with wildcards like '?' and '*' must have those characters escaped unless they are intended to function as wildcards.
Can Connection Object Members be used for file operations other than SFTP in NetSuite?
No, Connection Object Members focus specifically on SFTP file management. For other file operations, alternatives like RESTlets and SOAP Web Services are recommended.
Source: Connection Object Members 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 Integration

View all Integration articles →