Trouble seeing the images? Right click on images and open in new tab to enlarge or zoom in on the page (Ctrl + mousewheel).
In this article we provide detail on the API calls for managing Roles in WebReports.
Why Use the Users API Calls?
The Users API calls will allow users with the API role, or API key, to invite and delete users in WebReports.
Example Users API calls include the following:
- InviteUsers (takes a list of "InviteUsers")
- DeleteUsers (takes a list of string / usernames)
API Prerequisites:
- Must have the API role in WebReports
- Established Connection/Cookie
Video Tutorial:
Not yet available.
Structure / Examples of Role API Calls
Users API Endpoints:
Invite Users :/api/Service/InviteUsers
Delete Users:/api/Service/DeleteUsers
Role API Endpoints using the API Key Controller
/extapi/APIWebReport/InviteUsers
/extapi/APIWebReport/DeleteUsers
Users Parameter Structure:
When sending a call to either InviteUsers/DeleteUsers, the controller is looking for a list of "string".
public class InviteUsers
}
InviteUsers:
(Creating a List of "InviteUsers" to send to the API)
Dim Users as New list(of InviteUsers)
(Creating a User)
Dim User as New InviteUsers
(Creating a List of roles to add to the user)
dim UserRoles as new List(of string)
UserRoles.Add("Role1")
UserRoles.Add("Role2")
(Adding the roles to the User)
User.Roles.Add(UserRoles)
(Creating a List of connections to add to the user)
dim UserConnections as new list(of string)
UserConnections.Add("Con1")
(Adding the connections to the User)
User.Connections.Add(UserConnections)
(Sending the List of "InviteUsers" to the API Call)
Dim Params As StringContent = New StringContent(JsonConvert.SerializeObject(Users, Formatting.Indented), Encoding.UTF8, "application/json")
Dim openResponse = client.PostAsync("server/api/Service/InviteUsers", Params).GetAwaiter().GetResult()
DeleteUsers:
(Creating a List of Users to send to the API)
Dim Users as New list(of string)
Users.Add("User1")
Users.Add("User2")
(Sending the List of Users to the API Call)
Dim Params As StringContent = New StringContent(JsonConvert.SerializeObject(Users, Formatting.Indented), Encoding.UTF8, "application/json")
Dim openResponse = client.PostAsync("server/api/Service/DeleteUsers", Params).GetAwaiter().GetResult()
Comments
0 comments
Please sign in to leave a comment.