Include Data in a Request Body
In some situations, you might want to bypass the data upload and dataset creation procedures and access in-place data directly from a CreateJob request. The data and metadata must be included in the form of infotables that are passed as input parameters when the request is submitted.
This technique works best for small amounts of data, so as not to strain the system constraints.
There are multiple methods available to include data in the body of a CreateJob request:
In a REST API request
In a ThingWorx Composer mashup (other than Analytics Builder)
In a ThingWorx Composer javascript service
Regardless of the request method you use, you must first prepare both the AnalyticsDatasetRef and the AnalyticsDatasetMetadata infotables for inclusion in the request. For more information, see Key Analytics Infotables.
The metadata infotable has a static structure. But keep the following in mind when preparing the dataset infotable:
datasetURI – Must take the following form: body:/
format – Must be: CSV
data – Must be provided in the form of an infotable that includes only primitive base type fields (STRING, INTEGER, NUMBER).
metadata – Must be provided in the form of an infotable. The structure of this infotable is defined and static (AnalyticsDatasetMetadata).
For a sample of a training request, see the Sample Post Body section.
There is one difference between submitting the CreateJob request via a REST call versus in ThingWorx Composer via a mashup or a javascript service. In ThingWorx Composer, the data and metadata parameters are mapped to an infotable object. But in a REST call, a JSON version of the infotable must be built to map these parameters.
For information about communicating with ThingWorx REST endpoints, see ThingWorx REST API in the ThingWorx Help Center.
Was this helpful?