Regent Award .Net API User Guide
Overview
The Regent Award financial aid system supports third-party integration via a rich and robust API in the form of web services. The Regent Award API covers nearly 100% of all functionality available in our management UI. Interoperability is achieved via the SOAP protocol. The service definitions are provided as WSDL documents.
With few exceptions, service methods follow the convention of accepting a custom, complex type as an input parameter, and returning a custom, complex type as an output parameter. This version of the Web Service API User Guide details service methods relating to document, user, and role management.
This guide is geared towards Microsoft .Net C# developers. However, the majority of the concepts and examples provided apply to all programming languages and frameworks.
WSDL Documentation
WSDL documentation is located here: http://dev.regenteducation.net/wsdldocs/RegentEnterpriseWebService_1.html
Adding a Service Reference in Visual Studio
Adding a reference to these services to your Visual Studio project can be accomplished in a number of ways including use of svcutil for more advanced scenarios, or by simply using the Add Service Reference available within your Visual Studio project as illustrated in the screenshot below.
API Security
The Regent Award API is secured by the following methods:
- HTTPS
- For transport layer security
- IP Whitelisting and/or VPN only access
- API service credentials.
- A SecurityToken object containing a Regent provided ClientId and Token is passed into every API service call
Important SecurityToken Information
A SecurityToken object needs to be passed into every Regent API service method which contains both the API service credentials and the user that the service method should execute as. The ClientId/Token gets you access to call the services.
In some cases it may be appropriate to have one or more system users that would reflect different customer applications. For example, there could be different credentials and/or users for various customer services that is leveraging the Regent Award API:
- Student Information System
- Document Management System
- Satisfactory Academic Progress service
This allows for clear user tracking in the Regent Award system by reflecting the system creating or modifying data.
Store ClientId and Token values in application configuration! These may be different between production and test environments. And they may need to be updated at a later date.
Use a common method to create the SecurityToken in the application code.
SecurityToken fields
- Username
- String. Provided by Regent.
- UserId
- Long. Provided by Regent.
- DashboardAdmin
- Boolean. Always set to true.
- ClientId
- String. Provided by Regent.
- Token
- String. Provided by Regent
Working with Student Identifiers
Regent Award maintains a unique internal ID for every student record in its system, typically referred to as studentId. Customers supply their own student identifiers in the Student Batch Load process when creating or updating students in Regent. These are referred to as external ID's in Regent Award and four are provided for student records: externalId1, externalId2, externalId3, and externalId4.
The majority of Regent service methods expect to work with Regent Awards internal unique studentId, NOT the customer external identifiers. Therefore, customers need to get Regent's internal student ids prior to interacting with Regent Web Services.
There are multiple strategies available for customers to ensure they have the studentId for student records.
- Individually look up Regent Award studentIds based on customer externalId prior to utilzing service methods for a given student.
- Retrieve Regent Award studentId's in bulk by leveraging Regent Award Data Views or via API Service Methods that return lists of students.
In many cases it would be best practice and recommended for customers to cache or store Regent's student identifiers in their system. This would especially be the case if a customer has large student populations and/or are calling services very frequently. They could be cached as they are looked up one-off, or in bulk. Developers should be aware that it is possible for customers to effectively change Regent hosted external identifiers by both service method calls and the Student Batch Load file process. This could happen for a number of reasons and the customer should be aware of their processing scenarios if caching studentIds.
Regent Award Student Identifier Lookup C# Example
long studentid = -1; string externalId1 = "EXTERNAL_ID_HERE"; GetStudentsRequest getStudentsRequest = new GetStudentsRequest(); getStudentsRequest.SecurityToken = securityToken; // update with your instantiated SecurityToken object // this method is special in that you can build a dynamic set of filters. Here we want to find student getStudentsRequest.filter = new Filter { Filters = new List<Filter> { new Filter {Field = "externalId1", Operator = "eq", Value = externalId1} }.ToArray() }; getStudentsRequest.endRowIndex = 10; GetStudentsResponse getStudentsResponse = client.getStudentBasicInfoList(getStudentsRequest); if (!getStudentsResponse.Success) throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentBasicInfoList", getStudentsResponse.Message)); // expect you'll get 1 and only 1 record. Adjust for your needs. if (getStudentsResponse.Records.Length != 1) { throw new ApplicationException(string.Format("Expected 1 student record but found {0} records", getStudentsResponse.Records.Length)); } studentid = getStudentsResponse.Records[0].Id; return studentid;
USER MANAGEMENT
A common use of the User and Roles services in Regent Award is to systematically provision user accounts/roles. For example, a customer may utilize the Regent Award services along with an existing enterprise identity management system to A) determine whether to allow access to Regent Award at all and B) map Regent Award roles to roles defined in the customer system and C) ensure user access to Regent Award is removed in termination or position change scenarios.
* The “Password must be reset on next login” checkbox in the Regent Award UI translates to the PasswordExpiresOn field. If PasswordExpiresOn is set prior to the current utc time, the checkbox would be checked. To update an existing user to force a reset of password, get the login record from getLogin method, and then update PasswordExpiresOn property on the login record to the past in UTC time. Example: “.PasswordExpiresOn = DateTime.UtcNow.AddDays(-1);”. Then call the updateLogin method to persist the change to the login record.
Creating a User
Method
UpdateLoginResponse createLogin(UpdateLoginRequest request);
Description
This method is used to create a new user account.
To call this method, you need to construct a UpdateLoginRequest object with the following properties:
public SecurityToken SecurityToken { get; set; } public Login Record { get; set; } SecurityToken properties: public long UserId { get; set; } // required public bool DashboardAdmin { get; set; } // required public string Username { get; set; } // required public string CurrentRole { get; set; } // required public string Token { get; set; } // required public string ClientId { get; set; } // optional; used to support 3rd-party authentication
public Int64 LoginId { get; set; } // required public String Username { get; set; } // required; 255 character maximum public String Password { get; set; } // optional; 255 character maximum public String PasswordSalt { get; set; } // optional; 255 character maximum public String Email { get; set; } // required; 128 character maximum public String FirstName { get; set; } // optional; 35 character maximum public String LastName { get; set; } // optional; 35 character maximum public bool IsActive { get; set; } // required public bool DashboardAdmin { get; set; } // required public Int32 LockoutAttempts { get; set;} // required public DateTime? LockoutDate { get; set; } // optional; UTC-based public DateTime? LastLoginDate { get; set; } // optional; UTC-based public DateTime PasswordSetDate { get; set; }// optional; UTC-based public DateTime? PasswordExpiresOn { get; set; }// optional public Int32 UTCOffset { get; set; } // optional public String Timezone { get; set; } // optional public String ExternalId1 { get; set; } // optional; 50 character maximum public String ExternalId2 { get; set; } // optional; 50 character maximum public String SingleSignOnCode { get; set; } // optional public String LoginAuthenticationTypeCode { get; set; } // required: // Password/SingleSignOn
public Login Record { get; set; }// see above public bool Success { get; set; } public bool ErrorYN { get; set; } public bool StaleEntity { get; set; } public String Message { get; set; } public int totalCount { get; set; } public long processingTime { get; set; } public ValidationResults ValidationResults { get; set; }
public bool IsValid { get; set; } public ValidationResult[] Results { get; set; } ValidationResult properties: public String Property { get; set; } public String Message { get; set; }
C# Code Sample
private void CreateUser() { RegentEnterpriseServiceClient wsClient = null; // CAUTION: don't wrap client in using statement: // http://msdn.microsoft.com/en-us/library/aa355056.aspx try { #region authenticate user – replace with appropriate implementation SecurityToken securityToken = new SecurityToken() { Username = "system", UserId = -1, DashboardAdmin = true, // provided by Regent. These would be config settings ClientId = "CustomerClientId", Token = "l23kj5hklj3h4l3kj" }; #endregion authenticate user // this would likely be a config setting string wsUrl = "https://schoolremwsqa.regenteducation.net/RegentEnterpriseWebService.svc"; wsClient = new RegentEnterpriseServiceClient(); wsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(wsUrl); // set up request UpdateLoginRequest createLoginRequest = new UpdateLoginRequest(); createLoginRequest.SecurityToken = securityToken; createLoginRequest.Record = new Login() { Username = "tuser1", // required; 255 chars max Email = "tuser1@school.edu", // required; 128 chars max IsActive = true, // required DashboardAdmin = true, // required Password = "test", // required; 255 chars max PasswordSetDate = DateTime.UtcNow, // required PasswordExpiresOn = null, // optional FirstName = "Test", // optional; 35 chars max LastName = "User1" // optional; 35 chars max }; // make call UpdateLoginResponse createLoginResponse = wsClient.createLogin(createLoginRequest); // check for errors if (createLoginResponse == null) throw new ApplicationException("No response from web service."); if (!createLoginResponse.Success) throw new ApplicationException(createLoginResponse.Message); // process updateLoginResponse.Record MessageBox.Show(String.Format("LoginId {0} created.", createLoginResponse.Record.LoginId)); } catch (Exception ex) { if (wsClient != null) wsClient.Abort(); MessageBox.Show(ex.Message); } }
Getting User Information
Method
GetLoginResponse getLogin(GetLoginRequest request);
Description
This method is used to get information for an existing user account.
To call this method, you need to construct a GetLoginRequest object with the following properties. GetLoginResponse has the same properties as UpdateLoginResponse — see Creating a User.
public SecurityToken SecurityToken { get; set; } // see Creating a User public new long? Id { get; set; } public string Username { get; set; }
C# Code Sample
private GetLoginResponse GetUserInfo(long userId) { RegentEnterpriseServiceClient wsClient = null; GetLoginResponse getLoginResponse = null; // CAUTION: don't wrap client in using statement: // http://msdn.microsoft.com/en-us/library/aa355056.aspx try { #region authenticate user – replace with appropriate implementation SecurityToken securityToken = new SecurityToken() { Username = "system", UserId = -1, DashboardAdmin = true, // provided by Regent. These would be config settings ClientId = "CustomerClientId", Token = "l23kj5hklj3h4l3kj" }; #endregion authenticate user // this would likely be a config setting string wsUrl = "https://schoolremwsqa.regenteducation.net/RegentEnterpriseWebService.svc"; wsClient = new RegentEnterpriseServiceClient(); wsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(wsUrl); // set up request GetLoginRequest getLoginRequest = new GetLoginRequest(); getLoginRequest.SecurityToken = securityToken; getLoginRequest.Id = userId; // make call getLoginResponse = wsClient.getLogin(getLoginRequest); // check for errors if (getLoginResponse == null) throw new ApplicationException("No response from web service."); if (!getLoginResponse.Success) throw new ApplicationException(getLoginResponse.Message); } catch (Exception ex) { if (wsClient != null) wsClient.Abort(); throw ex; } return getLoginResponse; }
Updating a User
Method
UpdateLoginResponse updateLogin(UpdateLoginRequest request);
Description
This method is used to update an existing user account.
This method takes the same UpdateLoginRequest object and returns the same UpdateLoginResponse object as createLogin() — see Creating a User. Prior to making updates, the UpdateLoginRequest.Record should be populated using getLogin() to pick up the current property values— see Getting User Information. Once populated, change the properties to be updated.
C# Code Sample
private void UpdateUserName(long userId, string newUserName) { RegentEnterpriseServiceClient wsClient = null; // CAUTION: don't wrap client in using statement: // http://msdn.microsoft.com/en-us/library/aa355056.aspx try { #region authenticate user – replace with appropriate implementation SecurityToken securityToken = new SecurityToken() { Username = "system", UserId = -1, DashboardAdmin = true, // provided by Regent. These would be config settings ClientId = "CustomerClientId", Token = "l23kj5hklj3h4l3kj" }; #endregion authenticate user // this would likely be a config setting string wsUrl = "https://schoolremwsqa.regenteducation.net/RegentEnterpriseWebService.svc"; wsClient = new RegentEnterpriseServiceClient(); wsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(wsUrl); // get current user info GetLoginResponse userInfo = GetUserInfo(userId); #region perform update // set up request UpdateLoginRequest updateLoginRequest = new UpdateLoginRequest(); updateLoginRequest.SecurityToken = securityToken; updateLoginRequest.Record = userInfo.Record; // set the values being updated — LoginId and VersionStamp cannot be updated // CreatedOn shouldn't be updated updateLoginRequest.Record.Username = newUserName; // make call UpdateLoginResponse updateLoginResponse = wsClient.updateLogin(updateLoginRequest); // check for errors if (updateLoginResponse == null) throw new ApplicationException("No response from web service."); if (!updateLoginResponse.Success) throw new ApplicationException(updateLoginResponse.Message); #endregion perform update // process updateLoginResponse.Record MessageBox.Show(String.Format("{0} updated.", updateLoginResponse.Record.LoginId)); } catch (Exception ex) { if (wsClient != null) wsClient.Abort(); MessageBox.Show(ex.Message); } }
Deleting a User
Method
UpdateLoginResponse deleteLogin(UpdateLoginRequest request);
Description
This method is used to deactivate an existing user account.
This method takes the same UpdateLoginRequest object and returns the same UpdateLoginResponse object as createLogin() — see Creating a User.
C# Code Sample
private void DeleteUser(long userId) { RegentEnterpriseServiceClient wsClient = null; // CAUTION: don't wrap client in using statement: // http://msdn.microsoft.com/en-us/library/aa355056.aspx try { #region authenticate user – replace with appropriate implementation SecurityToken securityToken = new SecurityToken() { Username = "system", UserId = -1, DashboardAdmin = true, // provided by Regent. These would be config settings ClientId = "CustomerClientId", Token = "l23kj5hklj3h4l3kj" }; #endregion authenticate user // this would likely be a config setting string wsUrl = "https://schoolremwsqa.regenteducation.net/RegentEnterpriseWebService.svc"; wsClient = new RegentEnterpriseServiceClient(); wsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(wsUrl); // get current user info GetLoginResponse userInfo = GetUserInfo(userId); #region perform deletion // set up request UpdateLoginRequest deleteLoginRequest = new UpdateLoginRequest(); deleteLoginRequest.SecurityToken = securityToken; deleteLoginRequest.Record = userInfo.Record; // make call UpdateLoginResponse deleteLoginResponse = wsClient.deleteLogin(deleteLoginRequest); // check for errors if (deleteLoginResponse == null) throw new ApplicationException("No response from web service."); if (!deleteLoginResponse.Success) throw new ApplicationException(deleteLoginResponse.Message); #endregion perform deletion // process updateLoginResponse.Record MessageBox.Show(String.Format("{0} deleted.", deleteLoginResponse.Record.LoginId)); } catch (Exception ex) { if (wsClient != null) wsClient.Abort(); MessageBox.Show(ex.Message); } }
ROLE MANAGEMENT
Getting a List of Roles
Method
GetRoleListResponse getRoleList(GetRoleListRequest request);
Description
This method is used to obtain the roles that have been configured.
To call this method, you need to construct a GetRoleListRequest object with the following properties:
public SecurityToken SecurityToken { get; set; } public string filterCondition { get; set; } public string sortColumn { get; set; } public string sortType { get; set; } public int startRowIndex { get; set; } public int endRowIndex { get; set; } SecurityToken properties: public long UserId { get; set; } // required public bool DashboardAdmin { get; set; } // required public string Username { get; set; } // required public string CurrentRole { get; set; } // required public string Token { get; set; } // required public string ClientId { get; set; } // optional; used to support // 3rd-party authentication GetRoleListResponse has the following properties: public List<RoleListItem> Records { get; set; } public bool Success { get; set; } public bool ErrorYN { get; set; } public bool StaleEntity { get; set; } public String Message { get; set; } public int totalCount { get; set; } public long processingTime { get; set; } public ValidationResults ValidationResults { get; set; } RoleListItem properties: public Int64? RowNum { get; set; } public Int32? TotalRows { get; set; } ValidationResults properties: public bool IsValid { get; set; } public ValidationResult[] Results { get; set; } ValidationResult properties: public String Property { get; set; } public String Message { get; set; }
C# Code Sample
private GetRoleListResponse GetRoleList() { RegentEnterpriseServiceClient wsClient = null; GetRoleListResponse getRoleListResponse = null; // CAUTION: don't wrap client in using statement: // http://msdn.microsoft.com/en-us/library/aa355056.aspx try { #region authenticate user – replace with appropriate implementation SecurityToken securityToken = new SecurityToken() { Username = "system", UserId = -1, DashboardAdmin = true, // provided by Regent. These would be config settings ClientId = "CustomerClientId", Token = "l23kj5hklj3h4l3kj" }; #endregion authenticate user // this would likely be a config setting string wsUrl = "https://schoolremwsqa.regenteducation.net/RegentEnterpriseWebService.svc"; wsClient = new RegentEnterpriseServiceClient(); wsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(wsUrl); // set up request GetRoleListRequest getRoleListRequest = new GetRoleListRequest() { SecurityToken = securityToken, filterCondition = "deleted = 0", sortColumn = "name", sortType = "desc", startRowIndex = 0, endRowIndex = 99999 }; // make call getRoleListResponse = wsClient.getRoleList(getRoleListRequest); // check for errors if (getRoleListResponse == null) throw new ApplicationException("No response from web service."); if (!getRoleListResponse.Success) throw new ApplicationException(getRoleListResponse.Message); } catch (Exception ex) { if (wsClient != null) wsClient.Abort(); throw ex; } return getRoleListResponse; }