client/splunk.js
function(id, namespace) {                
            if (utils.isEmpty(namespace)) {
                namespace = null;
            }          
            
            if (!id) {
                throw new Error("Must suply a non-empty name.");
            }

            if (namespace && (namespace.app === '-' || namespace.owner === '-')) {
                throw new Error("When searching for an entity, wildcards are not allowed in the namespace. Please refine your search.");
            }
            
            var fullPath = null;
            if (this._entitiesByName.hasOwnProperty(id)) {
                var entities = this._entitiesByName[id];                 
                
                if (entities.length === 1 && !namespace) {
                    // If there is only one entity with the
                    // specified name and the user did not
                    // specify a namespace, then we just
                    // return it
                    return entities[0];
                }
                else if (entities.length === 1 && namespace) {
                    // If we specified a namespace, then we 
                    // only return the entity if it matches
                    // the full path
                    fullPath = this.service.fullpath(entities[0].path(), namespace);
                    if (entities[0].qualifiedPath === fullPath) {
                        return entities[0];
                    }
                    else {
                        return null;
                    }
                }
                else if (entities.length > 1 && !namespace) {
                    // If there is more than one entity and we didn't
                    // specify a namespace, then we return an error
                    // saying the match is ambiguous
                    throw new Error("Ambiguous match for name '" + id + "'");
                }
                else {
                    // There is more than one entity, and we do have
                    // a namespace, so we try and find it
                    for(var i = 0; i < entities.length; i++) {
                        var entity = entities[i];
                        fullPath = this.service.fullpath(entities[i].path(), namespace);
                        if (entity.qualifiedPath === fullPath) {
                            return entity;
                        }
                    }                            
                }
            }
            else {
                return null;
            }    
        }
function(id, namespace) {                
            if (utils.isEmpty(namespace)) {
                namespace = null;
            }          
            
            if (!id) {
                throw new Error("Must suply a non-empty name.");
            }

            if (namespace && (namespace.app === '-' || namespace.owner === '-')) {
                throw new Error("When searching for an entity, wildcards are not allowed in the namespace. Please refine your search.");
            }
            
            var fullPath = null;
            if (this._entitiesByName.hasOwnProperty(id)) {
                var entities = this._entitiesByName[id];                 
                
                if (entities.length === 1 && !namespace) {
                    // If there is only one entity with the
                    // specified name and the user did not
                    // specify a namespace, then we just
                    // return it
                    return entities[0];
                }
                else if (entities.length === 1 && namespace) {
                    // If we specified a namespace, then we 
                    // only return the entity if it matches
                    // the full path
                    fullPath = this.service.fullpath(entities[0].path(), namespace);
                    if (entities[0].qualifiedPath === fullPath) {
                        return entities[0];
                    }
                    else {
                        return null;
                    }
                }
                else if (entities.length > 1 && !namespace) {
                    // If there is more than one entity and we didn't
                    // specify a namespace, then we return an error
                    // saying the match is ambiguous
                    throw new Error("Ambiguous match for name '" + id + "'");
                }
                else {
                    // There is more than one entity, and we do have
                    // a namespace, so we try and find it
                    for(var i = 0; i < entities.length; i++) {
                        var entity = entities[i];
                        fullPath = this.service.fullpath(entities[i].path(), namespace);
                        if (entity.qualifiedPath === fullPath) {
                            return entity;
                        }
                    }                            
                }
            }
            else {
                return null;
            }    
        }
function ( id , namespace ) { if ( utils . isEmpty ( namespace ) ) { namespace = null ; } if ( ! id ) { throw new Error ( "Must suply a non-empty name." ) ; } if ( namespace && ( namespace . app === '-' || namespace . owner === '-' ) ) { throw new Error ( "When searching for an entity, wildcards are not allowed in the namespace. Please refine your search." ) ; } var fullPath = null ; if ( this . _entitiesByName . hasOwnProperty ( id ) ) { var entities = this . _entitiesByName [ id ] ; if ( entities . length === 1 && ! namespace ) { // If there is only one entity with the // specified name and the user did not // specify a namespace, then we just // return it return entities [ 0 ] ; } else if ( entities . length === 1 && namespace ) { // If we specified a namespace, then we  // only return the entity if it matches // the full path fullPath = this . service . fullpath ( entities [ 0 ] . path ( ) , namespace ) ; if ( entities [ 0 ] . qualifiedPath === fullPath ) { return entities [ 0 ] ; } else { return null ; } } else if ( entities . length > 1 && ! namespace ) { // If there is more than one entity and we didn't // specify a namespace, then we return an error // saying the match is ambiguous throw new Error ( "Ambiguous match for name '" + id + "'" ) ; } else { // There is more than one entity, and we do have // a namespace, so we try and find it for ( var i = 0 ; i < entities . length ; i ++ ) { var entity = entities [ i ] ; fullPath = this . service . fullpath ( entities [ i ] . path ( ) , namespace ) ; if ( entity . qualifiedPath === fullPath ) { return entity ; } } } } else { return null ; } }
Returns a specific entity from the collection.

@example

var apps = service.apps();
apps.fetch(function(err, apps) {
var app = apps.item("search");
console.log("Search App Found: " + !!app);
// `app` is an Application object.
});

@param {String} id The name of the entity to retrieve.
@param {Object} namespace Namespace information:
- `owner` (_string_): The Splunk username, such as "admin". A value of "nobody" means no specific user. The wildcard value "-", is not acceptable when searching for an entity.
- `app` (_string_): The app context for this resource (such as "search"). The wildcard value "-" is unacceptable when searching for an entity.
- `sharing` (_string_): A mode that indicates how the resource is shared. The sharing mode can be "user", "app", "global", or "system".
@returns {splunkjs.Service.Entity} The entity, or `null` if one is not found.

@method splunkjs.Service.Collection
Returns a specific entity from the collection .