Skip to main content
Skip table of contents

SOAP API HostService, Methods

Method: AddHost

Description

Add a new Host.            

Input

The input of this method is the argument AddHost having the following structure.

Element

Type

Nillable?

Description

hostToAdd

HostDataModel

Yes

The host to add.

Output

The result of the save.

Element

Type

Nillable?

Description

AddHostResult

SaveResult

Yes

A response object which supplies information about an attempt to insert data. This information includes record ID if created and error / warning messages if generated.

EXAMPLE

private SaveResult AddHost(HostDataModel Host)

        {

            HostServiceClient hostClient = null;

            SaveResult result = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                result = hostClient.AddHost(Host);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return result;

        }

Method: AddHostIdentifier

Description

Add a new host identifier.            

Input

The input of this method is the argument AddHostIdentifier having the following structure.

Element

Type

Nillable?

Description

hostID

int

No

The host ID.

identifierType

HostIdentifierTypeEnum

No

Type of the identifier.

identifierValue

string

Yes

The identifier value.

failOnValidationWarnings

boolean

No

If true, fail on validation warnings.

Output

The result of the update.

Element

Type

Nillable?

Description

AddHostIdentifierResult

SaveResult

Yes

A response object which supplies information about an attempt to insert data. This information includes record ID if created and error / warning messages if generated.

EXAMPLE

private SaveResult AddHostIdentifier(int hostID, HostIdentifierTypeEnum identifierType, string identifierValue, bool failOnValidationWarnings)

        {

            HostServiceClient hostClient = null;

            SaveResult result = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                result = hostClient.AddHostIdentifier(hostID, identifierType, identifierValue, failOnValidationWarnings);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return result;

        }

Method: DeleteHostIdentifier

Description

Deletes the host identifier.            

Input

The input of this method is the argument DeleteHostIdentifier having the following structure.

Element

Type

Nillable?

Description

hostID

int

No

The host ID.

hostIdentifierID

int

No

The host identifier ID.

Output

The result of the update.

Element

Type

Nillable?

Description

DeleteHostIdentifierResult

SaveResult

Yes

A response object which supplies information about an attempt to insert data. This information includes record ID if created and error / warning messages if generated.

EXAMPLE

private SaveResult DeleteHostIdentifier(int hostID, int hostIdentifierID)

        {

            HostServiceClient hostClient = null;

            SaveResult result = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                result = hostClient.DeleteHostIdentifier(hostID, hostIdentifierID);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return result;

        }

Method: GetHostByID

Description

Retrieve the host by ID.            

Input

The input of this method is the argument GetHostByID having the following structure.

Element

Type

Nillable?

Description

hostID

int

No

The host ID.

Output

The Host Data if one is found with this ID, otherwise null is returned.

Element

Type

Nillable?

Description

GetHostByIDResult

HostDataModel

Yes

Host response model.

Faults

Name

Content

Description

LogRhythmWebServiceFaultFault

LogRhythmWebServiceFault

This is the error message object for all of LogRhythm Web Services.  This object provides custom meaningful error messages to the client while retaining security precautions for the system.

EXAMPLE

private HostDataModel GetHostByID(int hostID)

        {

            HostServiceClient hostClient = null;

            HostDataModel model = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                model = hostClient.GetHostByID(hostID);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return model;

        }

Method: GetHostsByEntity

Description

Retrieve all hosts for a given entity.            

Input

The input of this method is the argument GetHostsByEntity having the following structure.

Element

Type

Nillable?

Description

entityID

int

No

The entity ID.

Output

A list of hosts for a given entity, or an empty list if none is found.

Element

Type

Nillable?

Description

GetHostsByEntityResult

ArrayOfHostDataModel

Yes

A response collection of host data models.

Faults

Name

Content

Description

LogRhythmWebServiceFaultFault

LogRhythmWebServiceFault

This is the error message object for all of LogRhythm Web Services.  This object provides custom meaningful error messages to the client while retaining security precautions for the system.

EXAMPLE

private HostDataModel[] GetHostsByEntity(int entityID)

        {

            HostServiceClient hostClient = null;

            HostDataModel[] model = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                model = hostClient.GetHostsByEntity(entityID);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return model;

        }

Method: GetHostsByEntityAndIPIdentifier

Description

Retrieve all hosts by entity and IP identifier.            

Input

The input of this method is the argument GetHostsByEntityAndIPIdentifier having the following structure.

Element

Type

Nillable?

Description

entityID

int

No

The entity ID.

ipIdentifier

string

Yes

The ip identifier.

Output

A list of matching hosts, or an empty list if none is found.

Element

Type

Nillable?

Description

GetHostsByEntityAndIPIdentifierResult

ArrayOfHostDataModel

Yes

A response collection of host data models.

Faults

Name

Content

Description

LogRhythmWebServiceFaultFault

LogRhythmWebServiceFault

This is the error message object for all of LogRhythm Web Services.  This object provides custom meaningful error messages to the client while retaining security precautions for the system.

EXAMPLE

private HostDataModel[] GetHostsByEntityAndIPIdentifier(int entityID, string ipIdentifier)

        {

            HostServiceClient hostClient = null;

            HostDataModel[] model = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                model = hostClient.GetHostsByEntityAndIPIdentifier(entityID, ipIdentifier);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return model;

        }

Method: GetHostsByEntityAndLogRhythmHostName

Description

Retrieve all hosts by entity and LogRhythm hostname.            

Input

The input of this method is the argument GetHostsByEntityAndLogRhythmHostName having the following structure.

Element

Type

Nillable?

Description

entityID

int

No

The entity ID.

LogRhythmHostname

string

Yes

The LogRhythm hostname.

Output

A list of matching hosts, or an empty list if none are found.

Element

Type

Nillable?

Description

GetHostsByEntityAndLogRhythmHostNameResult

ArrayOfHostDataModel

Yes

A response collection of host data models.

Faults

Name

Content

Description

LogRhythmWebServiceFaultFault

LogRhythmWebServiceFault

This is the error message object for all of LogRhythm Web Services.  This object provides custom meaningful error messages to the client while retaining security precautions for the system.

EXAMPLE

private HostDataModel[] GetHostsByEntityAndLogRhythmHostName(int entityID, string LogRhythmHostname)

        {

            HostServiceClient hostClient = null;

            HostDataModel[] model = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                model = hostClient.GetHostsByEntityAndLogRhythmHostName(entityID, LogRhythmHostname);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return model;

        }

Method: GetHostsByEntityAndNameIdentifier

Description

Retrieve all hosts by entity and host or DNS name identifier.            

Input

The input of this method is the argument GetHostsByEntityAndNameIdentifier having the following structure.

Element

Type

Nillable?

Description

entityID

int

No

The entity ID.

HostName

string

Yes

Name of the DNS or windows host.

Output

A list of matching hosts, or an empty list if none is found.

Element

Type

Nillable?

Description

GetHostsByEntityAndNameIdentifierResult

ArrayOfHostDataModel

Yes

A response collection of host data models.

Faults

Name

Content

Description

LogRhythmWebServiceFaultFault

LogRhythmWebServiceFault

This is the error message object for all of LogRhythm Web Services.  This object provides custom meaningful error messages to the client while retaining security precautions for the system.

EXAMPLE

private HostDataModel[] GetHostsByEntityAndNameIdentifier(int entityID, string HostName)

        {

            HostServiceClient hostClient = null;

            HostDataModel[] model = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                model = hostClient.GetHostsByEntityAndNameIdentifier(entityID, HostName);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return model;

        }

Method: GetHostsByIPIdentifier

Description

Retrieve all hosts by IP identifier.            

Input

The input of this method is the argument GetHostsByIPIdentifier having the following structure.

Element

Type

Nillable?

Description

ipIdentifier

string

Yes

The ip identifier.

Output

A list of matching hosts, or an empty list if none is found.

Element

Type

Nillable?

Description

GetHostsByIPIdentifierResult

ArrayOfHostDataModel

Yes

A response collection of host data models.

Faults

Name

Content

Description

LogRhythmWebServiceFaultFault

LogRhythmWebServiceFault

This is the error message object for all of LogRhythm Web Services.  This object provides custom meaningful error messages to the client while retaining security precautions for the system.

EXAMPLE

private HostDataModel[] GetHostsByIPIdentifier(string ipIdentifier)

        {

            HostServiceClient hostClient = null;

            HostDataModel[] model = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                model = hostClient.GetHostsByIPIdentifier(ipIdentifier);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return model;

        }

Method: GetHostsByLogRhythmHostName

Description

Retrieve all hosts by LogRhythm hostname.            

Input

The input of this method is the argument GetHostsByLogRhythmHostName having the following structure.

Element

Type

Nillable?

Description

LogRhythmHostname

string

Yes

The LogRhythm hostname.

Output

A list of hosts for the given hostname, or an empty list if none is found.

Element

Type

Nillable?

Description

GetHostsByLogRhythmHostNameResult

ArrayOfHostDataModel

Yes

A response collection of host data models.

Faults

Name

Content

Description

LogRhythmWebServiceFaultFault

LogRhythmWebServiceFault

This is the error message object for all of LogRhythm Web Services.  This object provides custom meaningful error messages to the client while retaining security precautions for the system.

EXAMPLE

private HostDataModel[] GetHostsByLogRhythmHostName(string LogRhythmHostname)

        {

            HostServiceClient hostClient = null;

            HostDataModel[] model = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                model = hostClient.GetHostsByLogRhythmHostName(LogRhythmHostname);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return model;

        }

Method: GetHostsByNameIdentifier

Description

Retrieve all hosts by host of DNS name identifier.            

Input

The input of this method is the argument GetHostsByNameIdentifier having the following structure.

Element

Type

Nillable?

Description

HostName

string

Yes

Name of the DNS or windows host.

Output

A list of matching hosts, or an empty list if none is found.

Element

Type

Nillable?

Description

GetHostsByNameIdentifierResult

ArrayOfHostDataModel

Yes

A response collection of host data models.

Faults

Name

Content

Description

LogRhythmWebServiceFaultFault

LogRhythmWebServiceFault

This is the error message object for all of LogRhythm Web Services.  This object provides custom meaningful error messages to the client while retaining security precautions for the system.

EXAMPLE

private HostDataModel[] GetHostsByNameIdentifier(string HostName)

        {

            HostServiceClient hostClient = null;

            HostDataModel[] model = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                model = hostClient.GetHostsByNameIdentifier(HostName);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return model;

        }

Method: UpdateHost

Description

Update a host.            

Input

The input of this method is the argument UpdateHost having the following structure.

Element

Type

Nillable?

Description

hostToUpdate

HostDataModel

Yes

The host to update.

Output

The result of the update.

Element

Type

Nillable?

Description

UpdateHostResult

SaveResult

Yes

A response object which supplies information about an attempt to insert data. This information includes record ID if created and error / warning messages if generated.

EXAMPLE

private SaveResult UpdateHost(HostDataModel Host)

        {

            HostServiceClient hostClient = null;

            SaveResult result = null;

            try

            {

                // Create connection to service.

                hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

                hostClient.ClientCredentials.UserName.UserName = username;

                hostClient.ClientCredentials.UserName.Password = password;

                // Call method retrieving data model.

                result = hostClient.UpdateHost(Host);

            }

            finally

            {

                if (hostClient != null && hostClient.State != System.ServiceModel.CommunicationState.Faulted)

                {

                    hostClient.Close();

                }

            }

            // This model is a single entity data model for the entity which ID was supplied.  Or if not found you have a null object.

            return result;

        }

Method: UpsertHosts

Description

Insert, update, or retire multiple hosts.            

Input

The input of this method is the argument UpsertHosts having the following structure.

Element

Type

Nillable?

Description

hostsToUpsert

ArrayofHostDataModel

No

The hosts to insert, update, or retire.

Output

The result of the update.

Element

Type

Nillable?

Description

SaveResult

ArrayOfHostDataModel

No

A response object that contains a save result for each host sent as the request. The data will contain a Key that was passed into the request, IDs, and any warnings or errors that occurred.

EXAMPLE

HostServiceClient hostClient = null;

HS.HostDataModel[] data = new HS.HostDataModel[3];

HS.HostDataModel hdm = new HS.HostDataModel()

{

        DateUpdated = DateTime.UtcNow,

        EntityID = 1,

        HostName = "Test",

        OSType = HS.HostOSEnum.Windows,

        OSVersion = "Windows 7",

        RecordStatus = HS.RecordStatusEnum.NewRecord,

        RiskThreshold = HS.RiskLevelEnum.LowLow,

        ThreatThreshold = HS.WatchLevelEnum.LowMedium,

        Key = 1

};

data.SetValue(hdm, 0);

HS.HostDataModel hdm2 = new HS.HostDataModel()

{

       DateUpdated = DateTime.UtcNow,

       EntityID = 1,

       HostName = "Test2",

       OSType = HS.HostOSEnum.Windows,

       OSVersion = "Windows 7",

       RecordStatus = HS.RecordStatusEnum.Updated,

       RiskThreshold = HS.RiskLevelEnum.MediumHigh,

       ThreatThreshold = HS.WatchLevelEnum.HighLow,

       Key = 2,

       HostID = 1

};

data.SetValue(hdm2, 1);

HS.HostDataModel hdm3 = new HS.HostDataModel()

{

       DateUpdated = DateTime.UtcNow,

       EntityID = 1,

       HostName = "Test2",

       OSType = HS.HostOSEnum.Windows,

       OSVersion = "Windows 7",

       RecordStatus = HS.RecordStatusEnum.RetireThis,

       RiskThreshold = HS.RiskLevelEnum.MediumHigh,

       ThreatThreshold = HS.WatchLevelEnum.HighLow,

       Key = 3,

       HostID = 2

};

data.SetValue(hdm3, 2);

try

{

       // Create connection to service.

       hostClient = new HostServiceClient("HostServiceBasicAuth_HostService");

       hostClient.ClientCredentials.UserName.UserName = username;

       hostClient.ClientCredentials.UserName.Password = password;

       HS.SaveResult[] results = hostClient.UpsertHosts(data);

       for (int i = 0; i < results.Length; i++)

       {

       if (results[i].Succeeded)

       {

              Console.WriteLine("Successfully added host {0}", results[i].DataID);

       }

       else

       {

              // On fail to know which Host failed you can look up by HostID

              // (in the case of insert there is no hostID) or look at the key that was passed into the request.

              StringBuilder sb = new StringBuilder();

              for (int j = 0; i < results[i].Errors.Length; i++)

              {

                     sb.AppendLine(results[i].Errors[j].ErrorMessage);

              }

              Console.WriteLine("Failed to add/update/retire host {0}. Reason: {1}",

              results[i].DataID == 0 ? results[i].Key : results[i].DataID,

                     sb.ToString());

              }

       }

}

finally

{

       hostClient.Close();

}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.