src/Classificationbox.Net/ServiceWrapper.cs
/// <summary>
/// Deletes the model with the given id.
/// </summary>
/// <param name="modelId">id of the model to delete</param>
/// <returns>OK for success, otherwise error message</returns>
Deletes the model with the given id.
Deletes the model with the given id .
public string DeleteModel(string modelId)
        {
            HttpClient client = new HttpClient();
            var request = new HttpRequestMessage
            {
                Method = HttpMethod.Delete,
                RequestUri = new Uri(string.Format("{0}/classificationbox/models/{1}", _baseUrl, modelId)),
                Headers = {
                    { HttpRequestHeader.Accept.ToString(), "application/json; charset=utf-8" }
                }
            };
            HttpResponseMessage rsp;
            try
            {
                rsp = client.SendAsync(request).GetAwaiter().GetResult();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                return ex.Message;
            }
            if (rsp.IsSuccessStatusCode)
            {
                return "OK";
            }
            else
                return "";
        }
public string DeleteModel ( string modelId ) { HttpClient client = new HttpClient ( ) ; var request = new HttpRequestMessage { Method = HttpMethod . Delete , RequestUri = new Uri ( string . Format ( " " , _baseUrl , modelId ) ) , Headers = { { HttpRequestHeader . Accept . ToString ( ) , " " } } } ; HttpResponseMessage rsp ; try { rsp = client . SendAsync ( request ) . GetAwaiter ( ) . GetResult ( ) ; } catch ( Exception ex ) { Debug . WriteLine ( ex . ToString ( ) ) ; return ex . Message ; } if ( rsp . IsSuccessStatusCode ) { return " " ; } else return " " ; }
Deletes the model with the given id.
Deletes the model with the given id .
OK for success, otherwise error message
OK for success otherwise error message
modelId
string
id of the model to delete
id of the model to delete