DELETE api/entity/{entitytype}/{id}

Deletes an item with the given id and type (eg: IncidentRequest, ChangeManagementTicket etc)

Request Information

URI Parameters

NameDescriptionTypeAdditional information
entitytype

string

Required

id

integer

Required

Body Parameters

None.

Response Information

HttpResponseMessage
NameDescriptionTypeAdditional information
Version

Version

None.

Content

HttpContent

None.

StatusCode

HttpStatusCode

None.

ReasonPhrase

string

None.

Headers

Collection of Object

None.

RequestMessage

HttpRequestMessage

None.

IsSuccessStatusCode

boolean

None.

Example Code in C#

 
        //REQUEST  
        int id = id of the ticket to delete
        string type = "changemanagementticket"
        string uri = string.Format("http://localhost/restapi/api/entity/{0}/{1}",id,type);
        HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
        //Assumption: CGRestAPI is configured to use WIA. Otherwise, sessionid needs to be sent in the headers
        webRequest.Credentials = CredentialCache.DefaultCredentials;
        webRequest.Method = "POST";
        webRequest.ContentType = "application/json";       
        HttpWebResponse httpWebResponse = (System.Net.HttpWebResponse)webRequest.GetResponse();
            
        //RESPONSE    
        HttpWebResponse httpWebResponse = (System.Net.HttpWebResponse)webRequest.GetResponse();
        //check the response