Open this page in the API Guide

DELETE /Account/{id}/

Deletes an account.
 

Request

Method Request URI
delete /API/Account/{id}/?sessionId=value

URI Parameters

URI Parameter Description
sessionId Current session ID. Specifying via an Authorization request header instead is recommended.

Path Parameters

Path Parameter Description
id The ID of the account to be deleted.

Request Headers

Authorization: Bearer <Current session ID>

Request Body

There is no Request Body for this function.

Response

Response Codes

Response Code Description
200 The operation completed successfully.
400 The request contained one or more invalid parameters.
403 The caller does not have the necessary privileges for the attempted operation.
405 The operation is not supported by the underlying accounts provider.
410 An account with the specified ID was not found.
440 The caller is not associated with a valid session.

Examples

This example will delete a user with the ID = 4614df4f-36a1-4e5c-9a13-712f7f156d48.

C# Java JavaScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.Net;
using System.Net.Http;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Web.Script.Serialization;
 
   ...
 
using (HttpClient httpClient = new HttpClient())
{
    // Get Session Id
    string logonUri = "http://localhost:8004/Api/LogOn/";
    var logonOptions = new
    {
        accountName = "admin",
        password = "1234",
        cultureName = string.Empty,
        deleteOtherSessions = true,
        isWindowsLogOn = false
    };
 
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    var requestBodyAsString = serializer.Serialize(logonOptions);
    StringContent content =
        new StringContent(
            requestBodyAsString,
            Encoding.UTF8,
            "application/json"
        );
 
    string jsonString = string.Empty;
 
    using (var response = httpClient.PostAsync(logonUri, content).Result)
    {
        jsonString =
            response.Content.ReadAsStringAsync().Result;
    }
 
    var obj = (Dictionary<string,object>) serializer.DeserializeObject(jsonString);
    string sessionId = obj["sessionId"].ToString();
 
    // Add an Authorization header
    httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", sessionId);
 
    using (var response = httpClient.DeleteAsync(url).Result)
    {
        if(response.StatusCode == HttpStatusCode.OK)
        {
            Console.WriteLine("Item Deleted");
        }
    }
}