User Endpoint
Get
This method returns a specific User.
Get/api/users/username/{username}
The URL must have the username. It returns the UserDto.
Microsoft.NET example:
UserDto user = serviceManager.User.GetUsername("manager");
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/users/username/manager"; var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey $.ajax({ url: geminiUrl, type: "GET", headers: { "Authorization": "Basic " + geminiUsername }, success: function (data) { alert('Success!'); } });
Get by User ID
This method returns a specific User.
Get/api/users/{userid}
The URL must have the User Id. It returns an UserDto.
Microsoft.NET example:
UserDto user = serviceManager.User.GetUser(1);
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/users/1"; var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey $.ajax({ url: geminiUrl, type: "GET", headers: { "Authorization": "Basic " + geminiUsername }, success: function (data) { alert('Success!'); } });
Get All
This method returns all Users.
Get/api/users
It returns a list of UserDto's.
Microsoft.NET example:
List<UserDto> users = serviceManager.User.GetUsers();
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/users"; var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey $.ajax({ url: geminiUrl, type: "GET", headers: { "Authorization": "Basic " + geminiUsername }, success: function (data) { alert('Success!'); } });
Get Active Users
This method returns a list of all active users.
Get/api/users/active
It returns a list of UserDto's.
Microsoft.NET example:
List<UserDto> users = serviceManager.User.GetActive();
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/users/active"; var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey $.ajax({ url: geminiUrl, type: "GET", headers: { "Authorization": "Basic " + geminiUsername }, success: function (data) { alert('Success!'); } });
Get Active Users Count
This method returns the number of active users.
Get/api/users/active/count
It returns a number.
Microsoft.NET example:
int amountOfUsers = serviceManager.User.GetActiveUserCount();
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/users/active/count"; var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey $.ajax({ url: geminiUrl, type: "GET", headers: { "Authorization": "Basic " + geminiUsername }, success: function (data) { alert('Success!'); } });
Create
This method creates a new user.
POST/api/users
The request body must contain the User Entity. The return value is the new UserDto where the user Id is populated.
Microsoft.NET example:
var user = new User(); user.Username = "manager"; user.Firstname = "Manager"; user.Surname = "Person"; user.Email = "admin@mycompany.com"; serviceManager.User.Create(user);
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/users"; var geminiLogin = Base64.encode("manager:xvitjc5bmm"); // user:apikey var geminiData = { Username: "manager", Firstname: "Manager", Surname: "Person", Email: "admin@mycompany.com", }; $.ajax({ url: geminiUrl, type: "POST", data: geminiData, headers: { "Authorization": "Basic " + geminiLogin }, success: function (data) { alert('Success!'); } });
Update
This method updates an existing User.
PUT/api/users
The request body must contain the User entity. The return value is the updated UserDto.
Microsoft.NET example:
UserDto data = new UserDto(); data.Entity.Id = 1; data.Entity.Username = "manager"; data.Entity.Firstname = "Manager"; data.Entity.Surname = "Person"; data.Entity.Email = "admin@mycompany.com"; serviceManager.User.Update(data.Entity);
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/users"; var geminiLogin = Base64.encode("manager:xvitjc5bmm"); // user:apikey var geminiData = { Id: "1", Username: "manager", Firstname: "Manager", Surname: "Person", Email: "admin@mycompany.com", }; $.ajax({ url: geminiUrl, type: "PUT", data: geminiData, headers: { "Authorization": "Basic " + geminiLogin }, success: function (data) { alert('Success!'); } });
Delete
This method deletes an User.
DELETE/api/users/{userid}
The URL must contain the User Id.
Microsoft.NET example:
serviceManager.User.Delete(1);
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/items/1"; var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey $.ajax({ url: geminiUrl, type: "DELETE", headers: { "Authorization": "Basic " + geminiUsername }, success: function () { alert('Success!'); } });