C# Example: Get an Incident
The following example shows how to get an Incident using C#.
Run Swagger Code Generation before attempting
to modify the code so that you do not receive reference errors.
using IO.Swagger.Api; namespace Trebuchet.WebApi.IntegrationTests.ExamplesForCustomers.GetanObject { public class GetAnObject { public void GetABusinessObject() { //Get an access token using CSM credentials var serviceApi = new ServiceApi("https://your server/CherwellApi/"); var tokenResponse = serviceApi.ServiceToken("password","your client id", null, "CSDAdmin", "CSDAdmin", null,"Internal"); //Create a new Business Object api object and add the default header var businessObjectApi = new BusinessObjectApi("https://your server/CherwellApi/"); businessObjectApi.Configuration.AddDefaultHeader("Authorization","Bearer " + tokenResponse.AccessToken); //Get the Business Object summary by name. This returns the Business Object ID var businessObjectSummaryByName = businessObjectApi.BusinessObjectGetBusinessObjectSummaryByNameV1("Incident"); //Get the Business Object by public ID var readResponse = businessObjectApi.BusinessObjectGetBusinessObjectByPublicIdV1(businessObjectSummaryByName[0].BusObId, "102667"); } } }