Download Item
Create download item records for files you want customers to purchase and download in your Web store. Customers are charged per download item as opposed to per item. For example, if you want to charge customers for music downloads per song, you would create a download item record for each song. If you want to charge customers per album, you would create one download item record and attach each song on the album to the record.
In SOAP web services, the download item record is defined in the listAcct (accounting) XSD.
The download item record type is not accessible until the Sell Download Files feature is enabled in your account. In SOAP web services an error is thrown if you attempt create, update, delete or search for a Download Item without first enabling the Sell Download Files feature. To enable this feature, a NetSuite administrator can go to Setup > Company > Enable Features and select the Items & Inventory subtab, select the Sell Downloadable Files check box and click Save.
For general information on the download item record, see these topics in the NetSuite Help Center:
Supported Operations
add | addList | delete | deleteList | get | getList | getSavedSearch | getSelectValue | search | searchMoreWithId | update | updateList | upsert | upsertList
You can also use the asynchronous equivalents of SOAP web services list operations. For information about asynchronous operations, see SOAP Web Services Asynchronous Operations. For more information about request processing, see Synchronous Versus Asynchronous Request Processing.
Field Definitions
The SOAP Schema Browser includes definitions for all body fields, sublist fields, search filters, and search joins available to this record. For details, see the SOAP Schema Browser’s download item reference page.
For information on using the SOAP Schema Browser, see SOAP Schema Browser.
Usage Notes
Please note the following when working with the download items record:
-
The download items record does not have its own search interface. Like all other item types in NetSuite, you must use the Item Search record to retrieve information for this record type.
-
Working with the download item is generally a two-step process. You must first create the download item record using the add operation, then you must use the attach operation to attach all associated files. Note that an error is thrown if you attempt to attach a file that does not already exist in NetSuite. If you choose, you can later use the detach operation to remove a file from a download item record.
You can create both the download item record and file record in one step using the addList operation. However, to attach any file to the download item record, you will still need to call the attach operation.
-
In SOAP web services there is a 10 MB file size limit for file upload. If you attempt to upload a file larger than 10 MB to attach to a download item record, an error is thrown.
-
When you do a get on download item records, the details of the files attached to the record are not returned in your SOAP response. If you need to get the list of files attached to a download item, you must do an advanced search on the item record and specify the fields on the file record that you want returned. If you want to update the files attached to a download item record, you must update the file record directly.
-
To search on the files associated with a download item record, use the file join on the Item Search record.
Sample Code
C#
NetSuiteService nss = new NetSuiteService();
ItemSearchAdvanced itemSearchAdv = new ItemSearchAdvanced();
// Create search criteria
ItemSearch itemSearch = new ItemSearch();
ItemSearchBasic itemSearchBasic = new ItemSearchBasic();
// Set item search type to downloadItem
SearchEnumMultiSelectField itemTypeFld = new SearchEnumMultiSelectField();
String [] itemTypes = new String[1];
itemTypes[0] = "_downloadItem";
itemTypeFld.searchValue = itemTypes;
itemTypeFld.operatorSpecified = true;
itemTypeFld.@operator = SearchEnumMultiSelectFieldOperator.anyOf;
itemSearchBasic.type = itemTypeFld;
// Select search return columns
ItemSearchRow itemRow = new ItemSearchRow();
// Select to return file internal id
FileSearchRowBasic fileRowBasic = new FileSearchRowBasic();
SearchColumnSelectField [] selectColumns = new SearchColumnSelectField[1];
SearchColumnSelectField selectColumn = new SearchColumnSelectField();
selectColumns[0] = selectColumn;
fileRowBasic.internalId = selectColumns;
// Select to return file name
SearchColumnStringField [] stringColumns = new SearchColumnStringField[1];
SearchColumnStringField stringColumn = new SearchColumnStringField();
stringColumns[0] = stringColumn;
fileRowBasic.name = stringColumns;
// Set file join
itemRow.fileJoin = fileRowBasic;
// Select to return item internalId
ItemSearchRowBasic itemRowBasic = new ItemSearchRowBasic();
itemRowBasic.internalId = selectColumns; // column definition can be reused
itemRow.basic = itemRowBasic;
// Set item search criteria
itemSearch.basic = itemSearchBasic;
itemSearchAdv.criteria = itemSearch;
// Set item return columns
itemSearchAdv.columns = itemRow;
// Perform search
SearchResult searchResult = nss.search(itemSearchAdv);
SOAP Request
<search xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
<searchRecord xmlns:q1="urn:accounting_2017_1.lists.webservices.netsuite.com" xsi:type="q1:ItemSearchAdvanced">
<q1:criteria>
<q1:basic>
<type operator="anyOf" xmlns="urn:common_2017_1.platform.webservices.netsuite.com">
<searchValue xmlns="urn:core_2017_1.platform.webservices.netsuite.com">_downloadItem</searchValue>
</type>
</q1:basic>
</q1:criteria>
<q1:columns>
<q1:basic>
<internalId xmlns="urn:common_2017_1.platform.webservices.netsuite.com" />
</q1:basic>
<q1:fileJoin>
<internalId xmlns="urn:common_2017_1.platform.webservices.netsuite.com" />
<name xmlns="urn:common_2017_1.platform.webservices.netsuite.com" />
</q1:fileJoin>
</q1:columns>
</searchRecord>
</search>
SOAP Response
<platformCore:searchRowList>
<platformCore:searchRow xsi:type="listAcct:ItemSearchRow" xmlns:listAcct="urn:accounting_2017_1.lists.webservices.netsuite.com">
<listAcct:basic xmlns:platformCommon="urn:common_2017_1.platform.webservices.netsuite.com">
<platformCommon:internalId>
<platformCore:searchValue internalId="105"/>
</platformCommon:internalId>
</listAcct:basic>
<listAcct:fileJoin xmlns:platformCommon="urn:common_2017_1.platform.webservices.netsuite.com">
<platformCommon:internalId>
<platformCore:searchValue internalId="239"/>
</platformCommon:internalId>
<platformCommon:name>
<platformCore:searchValue>IDreamedADreamLyrics.txt</platformCore:searchValue>
</platformCommon:name>
</listAcct:fileJoin>
</platformCore:searchRow>
</platformCore:searchRowList>