client/splunk.js
function(name, params, callback) {
            // If we get (name, callback) instead of (name, params, callback)
            // do the necessary variable swap
            if (utils.isFunction(params) && !callback) {
                callback = params;
                params = {};
            }

            params = params || {};
            callback = callback || function(){};
            name = name.replace(/ /g, "_");

            var that = this;
            return this.post("", {name: name, description: JSON.stringify(params)}, function(err, response) {
                if (err) {
                    callback(err);
                }
                else {
                    var dataModel = new root.DataModel(that.service, response.data.entry[0].name, that.namespace, response.data.entry[0]);
                    callback(null, dataModel);
                }
            });
        }
function(name, params, callback) {
            // If we get (name, callback) instead of (name, params, callback)
            // do the necessary variable swap
            if (utils.isFunction(params) && !callback) {
                callback = params;
                params = {};
            }

            params = params || {};
            callback = callback || function(){};
            name = name.replace(/ /g, "_");

            var that = this;
            return this.post("", {name: name, description: JSON.stringify(params)}, function(err, response) {
                if (err) {
                    callback(err);
                }
                else {
                    var dataModel = new root.DataModel(that.service, response.data.entry[0].name, that.namespace, response.data.entry[0]);
                    callback(null, dataModel);
                }
            });
        }
function ( name , params , callback ) { // If we get (name, callback) instead of (name, params, callback) // do the necessary variable swap if ( utils . isFunction ( params ) && ! callback ) { callback = params ; params = { } ; } params = params || { } ; callback = callback || function ( ) { } ; name = name . replace ( / / g , "_" ) ; var that = this ; return this . post ( "" , { name : name , description : JSON . stringify ( params ) } , function ( err , response ) { if ( err ) { callback ( err ) ; } else { var dataModel = new root . DataModel ( that . service , response . data . entry [ 0 ] . name , that . namespace , response . data . entry [ 0 ] ) ; callback ( null , dataModel ) ; } } ) ; }
Creates a new `DataModel` object with the given name and parameters.
It is preferred that you create data models through the Splunk
Enterprise with a browser.

@param {String} name The name of the data model to create. If it contains spaces they will be replaced
with underscores.
@param {Object} params A dictionary of properties.
@param {Function} callback A function to call with the new `DataModel` object: `(err, createdDataModel)`.

@method splunkjs.Service.DataModels
Creates a new DataModel object with the given name and parameters . It is preferred that you create data models through the Splunk Enterprise with a browser .