init

splunkjs.Service.Application.init

Constructor for splunkjs.Service.Application

Syntax

init: function(service, name)

Parameters

Name Type Description
service splunkjs.Service

A service instance

name String

The name of the application

Return

splunkjs.Service.Application. A splunkjs.Service.Application instance

updateInfo

splunkjs.Service.Application.updateInfo
Endpoint: apps/local/{name}/update

Retrieve any available update information for this app

Syntax

updateInfo: function(callback)

Parameters

Name Type Description
callback Function

A callback when the update information is retrieved: (err, info, app)

Examples

 var app = service.apps().item("MyApp");
 app.updateInfo(function(err, info, app) {
     console.log("UPDATE INFO: ", info);
 });

setupInfo

splunkjs.Service.Application.setupInfo
Endpoint: apps/local/{name}/setup

Retrieve information about the setup for this app

Syntax

setupInfo: function(callback)

Parameters

Name Type Description
callback Function

A callback when the setup information is retrieved: (err, info, app)

Examples

 var app = service.apps().item("app");
 app.setup(function(err, info, search) {
     console.log("SETUP INFO: ", info);
 });

path

splunkjs.Service.Application.path

REST path for this resource (with no namespace)

Syntax

path: function()

fetchOnUpdate

splunkjs.Service.Application.fetchOnUpdate

Whether or not to call fetch() after an update to fetch the updated item.

updated

splunkjs.Service.Entity.updated

Retrieve the updated time for this entity

Syntax

updated: function()

Return

String. The updated time for this entity

reload

splunkjs.Service.Entity.reload

Reload the entity

This will reload the entity on the server.

Syntax

reload: function(callback)

Parameters

Name Type Description
callback Function

A callback when the object is reloaded: (err, entity)

fetch

splunkjs.Service.Entity.fetch

Refresh the resource

This will fetch the object from the server and load it up.

Syntax

fetch: function(options, callback)

Parameters

Name Type Description
options Object

Optional dictionary of collection filtering and pagination options

callback Function

A callback when the object is retrieved: (err, resource)

fields

splunkjs.Service.Entity.fields

Retrieve the fields information for this entity

Syntax

fields: function()

Return

Object. The fields for this entity

enable

splunkjs.Service.Entity.enable

Enable the entity

This will enable the entity on the server.

Syntax

enable: function(callback)

Parameters

Name Type Description
callback Function

A callback when the object is enabled: (err, entity)

disable

splunkjs.Service.Entity.disable

Disable the entity

This will disable the entity on the server.

Syntax

disable: function(callback)

Parameters

Name Type Description
callback Function

A callback when the object is disabled: (err, entity)

update

splunkjs.Service.Entity.update

Update the entity

This will update the entity on the server.

Syntax

update: function(props, callback)

Parameters

Name Type Description
props Object

Properties to be updated the object with.

callback Function

A callback when the object is updated: (err, entity)

remove

splunkjs.Service.Entity.remove

Delete the entity

This will tell the server to delete this entity.

Syntax

remove: function(callback)

Parameters

Name Type Description
callback Function

A callback when the object is deleted: (err)

acl

splunkjs.Service.Entity.acl

Retrieve the ACL information for this entity

Syntax

acl: function()

Return

Object. The ACL for this entity

published

splunkjs.Service.Entity.published

Retrieve the published time for this entity

Syntax

published: function()

Return

String. The published time for this entity

_load

splunkjs.Service.Entity._load

Load the resource, also storing the properties.

Syntax

_load: function(properties)

Parameters

Name Type Description
properties Object

The properties for this resource

author

splunkjs.Service.Entity.author

Retrieve the author information for this entity

Syntax

author: function()

Return

String. The author for this entity

state

splunkjs.Service.Resource.state

Retrieve the state for this resource

This will retrieve the current full state for this resource.

Syntax

state: function()

Return

Object. The full state for this resource

properties

splunkjs.Service.Resource.properties

Retrieve the properties for this resource

This will retrieve the current properties for this resource.

Syntax

properties: function()

Return

Object. The properties for this resource

del

splunkjs.Service.Endpoint.del

Perform a relative DELETE request

Perform a relative DELETE request on this endpoint's path, combined with the parameters and a relative path if specified.

Syntax

del: function(relpath, params, callback)

Parameters

Name Type Description
relpath String

A relative path to append at the end of the path

params Object

A dictionary of parameters to add to the query string

callback Function

A callback to be invoked when the request is complete: (err, response)

Examples

 // Will make a request to {service.prefix}/search/jobs/123456
 var endpoint = new splunkjs.Service.Endpoint(service, "search/jobs/12345");
 endpoint.delete("", {}, function() { console.log("DELETED"))});

post

splunkjs.Service.Endpoint.post

Perform a relative POST request

Perform a relative POST request on this endpoint's path, combined with the parameters and a relative path if specified.

Syntax

post: function(relpath, params, callback)

Parameters

Name Type Description
relpath String

A relative path to append at the end of the path

params Object

A dictionary of parameters to add to the body

callback Function

A callback to be invoked when the request is complete: (err, response)

Examples

 // Will make a request to {service.prefix}/search/jobs/123456/control
 var endpoint = new splunkjs.Service.Endpoint(service, "search/jobs/12345");
 endpoint.post("control", {action: "cancel"}, function() { console.log("CANCELLED"))});

get

splunkjs.Service.Endpoint.get

Perform a relative GET request

Perform a relative GET request on this endpoint's path, combined with the parameters and a relative path if specified.

Syntax

get: function(relpath, params, callback)

Parameters

Name Type Description
relpath String

A relative path to append at the end of the path

params Object

A dictionary of parameters to add to the query string

callback Function

A callback to be invoked when the request is complete: (err, response)

Examples

 // Will make a request to {service.prefix}/search/jobs/123456/results?offset=1
 var endpoint = new splunkjs.Service.Endpoint(service, "search/jobs/12345");
 endpoint.get("results", {offset: 1}, function() { console.log("DONE"))});