Working with SuiteAnalytics Datasets in REST Web Services

In SuiteAnalytics Workbook, you analyze your company data using two distinct objects: a dataset and a workbook.

Datasets are the basis for all workbooks and workbook components in your account. In a dataset, you combine record type fields and criteria filters to create a query. The results of this query act as the source data for your workbooks.

Prior to 2020.1, you defined, visualized, and analyzed SuiteAnalytics Workbook source data in a single workbook object.

As of 2020.1, workbooks and datasets exist as separate objects, each with their own respective owners and accessibility rights. You define a dataset by selecting record types, fields, and criteria.

REST web services support the execution of datasets. Dataset execution replaces the previously available workbook execution function. You can execute both standard and custom datasets by using the dataset ID in your GET request.

When you work with datasets in REST web services, consider the following:

Executing Datasets Through REST Web Services

To execute a dataset, you send a GET request similar to the following:

            GET https://demo123.suitetalk.api.netsuite.com/services/rest/query/v1/dataset/ExampleDataset1/result 

          

The following is the response. The response is in a key-value structure or table.

Note:

REST web services do not return links to transaction records. For other record types, you must set the internal ID column for the dataset in the UI. If the internal ID is set, REST web services returns a link to non–transaction records.

            {
    "links": [
        {
            "rel": "self",
            "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/query/v1/dataset/ExempleDataset1/result?limit=1000&offset=0"
        }
    ],
    "items": [
        {
            "links": [],
            "amount": "5.33333334",
            "amount2": "2",
            "entity": "Customer AU",
            "item": "Item Tax 2 Lbs(AU)",
            "itemcount": "1",
            "postingperiod": "May 2010",
            "trandate": "5/28/2010"
        },
    ],
    "count": 1,
    "hasMore": false,
    "offset": 0,
    "totalResults": 1
} 

          

If you use formulas in datasets, when you execute a dataset in REST, the user-defined name of the formula is returned as the field ID for the formula field. You can define the formula field names when you define a dataset in the SuiteAnalytics Workbook UI. For information about defining datasets, see Defining a Dataset. For information about creating formula fields, see Creating Formula Fields in SuiteAnalytics Workbook.

The following example shows that the year_created formula name is returned as the ID for the formula field.

            {
   ...
    "items": [
        {
            "companyname": "Glenrock General Hospital",
            "email": "alan.rath@ns.com",
            "year_created": "2012"
        },
        {
            " companyname ": "Customer CyberSource",
            ...
        }
    ],
    "totalResults": 2
} 

          

When executing datasets through REST web services, consider the following:

  • The response from a dataset execution returned through REST web services may have different format and values than responses for record instance requests.

  • A REST web services request executes a single dataset. You cannot execute multiple datasets through REST web services at the same time.

Getting a List of Datasets Through REST Web Services

You can list all existing SuiteAnalytics Workbook datasets through REST web services. Datasets must be created in the SuiteAnalytics Workbook UI and cannot be created through REST web services. For information about creating datasets, see Defining a Dataset.

To list all existing datasets, you send a GET request similar to the following:

            GET https://demo123.suitetalk.api.netsuite.com/services/rest/query/v1/dataset/ 

          

The result contains the name, ID, and description of the datasets, and it provides information about the record type the dataset works on.

You can also use collection paging when you list all datasets. To list all existing datasets and page through the results, you send a GET request similar to the following:

            GET https://demo123.suitetalk.api.netsuite.com/services/rest/query/v1/dataset/?limit=10&offset=10 

          

The request returns 10 items on the list, starting by the 11th item. For information about paging, see Collection Paging.

Related Topics

Record Filtering and Query
Listing All Record Instances
Record Collection Filtering
Executing SuiteQL Queries Through REST Web Services
Collection Paging

General Notices