C# Example: Delete a Business Object
The following example shows how to delete a Business Object 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.Delete { public class DeleteABusinessObject { public void DeleteABusinessObjectByPublicId() { //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"); //Delete Business Object businessObjectApi.BusinessObjectDeleteBusinessObjectByPublicIdV1(businessObjectSummaryByName[0].BusObId, "123456"); } } }