Table of Contents |
---|
...
API Security
The Regent Award API is security secured by the following methods:
...
- Student Information System
- Document Management System
- Satisfactory Academic Progress service
This way there is allows for clear user tracking in the Regent Award system which reflects by reflecting the customer system creating or modifying data.
...
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
Login properties:
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
UpdateLoginResponse has the following properties:
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; }
ValidationResults properties:
public bool IsValid { get; set; }
public ValidationResult[] Results { get; set; }
ValidationResult properties:
public String Property { get; set; }
public String Message { get; set; }
Anchor | ||||
---|---|---|---|---|
|
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);
}
}
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
...
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:
public SecurityToken SecurityToken { get; set; } // see Creating a User
public new long? Id { get; set; }
public string Username { get; set; }
GetLoginResponse has the same properties as UpdateLoginResponse — see Creating a User.
Anchor | ||||
---|---|---|---|---|
|
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;
}
...
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.
...
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);
}
}
Anchor | ||||
---|---|---|---|---|
|
...
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.
Anchor | ||||
---|---|---|---|---|
|
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);
}
}
Anchor | ||||
---|---|---|---|---|
|
...
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; }
Anchor | ||||
---|---|---|---|---|
|
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;
}
...
This method is used to obtain the roles that have been configured for a specific user.
To call this method, you need to construct a GetRoleListRequest object with the following properties:
public SecurityToken SecurityToken { get; set; }
public long? LoginId { 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
The GetLoginRoleResponse object is the same as for getRoleList() — see Get List of Roles.
Anchor | ||||
---|---|---|---|---|
|
private GetRoleListResponse GetRoleListForUser(long userId)
{
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,
LoginId = userId,
filterCondition = "deleted = 0",
sortColumn = "name",
sortType = "desc",
startRowIndex = 0,
endRowIndex = 99999
};
// make call
getRoleListResponse = wsClient.getRoleListByLogin(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;
}
...
This method is used to get role information for an existing user role.
To call this method, you need to construct a GetLoginRoleRequest object with the following properties:
public SecurityToken SecurityToken { get; set; } // see Creating a User
public new long? Id { get; set; }
GetLoginRoleResponse has the same properties as UpdateLoginRoleResponse — see Assigning a User to a Role.
Anchor | ||||
---|---|---|---|---|
|
private GetLoginRoleResponse GetUserRoleInfo(long loginRoleId)
{
RegentEnterpriseServiceClient wsClient = null;
GetLoginRoleResponse getLoginRoleResponse = 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
GetLoginRoleRequest getLoginRoleRequest = new GetLoginRoleRequest();
getLoginRoleRequest.SecurityToken = securityToken;
getLoginRoleRequest.Id = loginRoleId; // loginRoleId - required
// make call
getLoginRoleResponse = wsClient.getLoginRole(getLoginRoleRequest);
// check for errors
if (getLoginRoleResponse == null)
throw new ApplicationException("No response from web service.");
if (!getLoginRoleResponse.Success)
throw new ApplicationException(getLoginRoleResponse.Message);
}
catch (Exception ex)
{
if (wsClient != null) wsClient.Abort();
throw ex;
}
return getLoginRoleResponse;
}
...
This method is used to create a new document for a student.
To call this method, you need to construct a UpdateDocumentRequirementRequest 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
DocumentRequirement properties:
public Int64 documentRequirementId { get; set; } // required
public Int64 studentId { get; set; } // required
public String documentIdString { get; set; } // required
public String ActivitySourceTypeCode { get; set; } // required; 50 chars max
public String ActivityLogEntryTypeCode { get; set; } // required; 50 chars max
public String documentRequirementStatusName { get; set; }
public Int64 documentId { get; set; }
public String documentName { get; set; } // optional; 35 chars max
public String documentDescription { get; set; }
public String documentUseTypeCode { get; set; } // optional; 50 chars max
public String documentUseTypeName { get; set; }
public DateTime? letterCorrespondenceDate { get; set; }
public DateTime? emailCorrespondenceDate { get; set; }
public DateTime? LastEmailLetterCorrespondenceDate { get; set; }
public DateTime? receivedDate { get; set; }
public DateTime? reviewedDate { get; set; }
public DateTime? createdDate { get; set; }
public String activitySourceName { get; set; } // optional; 50 chars max
public String activityTypeName { get; set; } // optional; 50 chars max
public String documentRequirementStatusCode { get; set; }
public Int64 federalAwardYearId { get; set; }
public Int64 academicYearId { get; set; }
public Int64 paymentPeriodId { get; set; }
public String federalAwardYearName { get; set; }
public String academicYearName { get; set; }
public String paymentPeriodName { get; set; }
public String ScopeName { get; set; }
public String documentMessage { get; set; }
public String message { get; set; } // optional; 256 chars max
public String Notes { get; set; } // optional; 250 chars max
public String documentTemplateFileName { get; set; }
public Boolean hasDocumentFlag { get; set; }
public String fileName { get; set; } // optional; 256 chars max
public String storedFileName { get; set; } // optional; 256 chars max
public Byte[] storedFile { get; set; }
public String fileURL { get; set; }
public String mimeType { get; set; } // optional; 255 chars max
public String documentFileName { get; set; } // optional; 256 chars max
public String documentStoredFileName { get; set; } // optional; 256 chars max
public String documentScopeCode { get; set; } // optional; 50 chars max
public String documentScopeName { get; set; }
public String documentIsirScopeCode { get; set; } // optional; 50 chars max
public String documentIsirScopeName { get; set; }
public Boolean assignedByOfficeUseOnly { get; set; }
public Int32 fileSize { get; set; }
public String DocumentInformation { get; set; }
public String DocumentRequirementExternalId { get; set; }
public String documentExternalId { get; set; }
public String studentExternalId1 { get; set; }
public String studentExternalId2 { get; set; }
public String studentExternalId3 { get; set; }
public String studentExternalId4 { get; set; }
public Int64? assignISIRRecordDataId { get; set; }
public Int64? satisfyISIRRecordDataId { get; set; }
public DateTime? EditLockTimestamp { get; set; }
public Boolean UpdateAttachment { get; set; }
public Boolean assignedByISIR { get; set; }
public string assignedBy { get; set; }
public string typeOfAssignedBy { get; set; }
public string valueOfAssignedBy { get; set; }
public DateTime documentRequirementStatusChangeOnDate { get; set; }
UpdateDocumentRequirementResponse has the following properties:
public DocumentRequirement 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; }
ValidationResults properties:
public bool IsValid { get; set; }
public ValidationResult[] Results { get; set; }
ValidationResult properties:
public String Property { get; set; }
public String Message { get; set; }
Anchor | ||||
---|---|---|---|---|
|
private void CreateDocumentRequirement()
{
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
UpdateDocumentRequirementRequest createDocumentRequirementRequest = new
UpdateDocumentRequirementRequest();
createDocumentRequirementRequest.SecurityToken = securityToken;
createDocumentRequirementRequest.Record = new DocumentRequirement()
{
documentId = "10960",
studentId = "27049",
ActivitySourceTypeCode = "SYSTEMACTION",
ActivityLogEntryTypeCode = "10960",
documentRequirementStatusCode = "Other",
};
// make call
UpdateDocumentRequirementResponse createDocumentrequirementResponse =
wsClient.createDocumentRequirement(createDocumentRequirementRequest);
// check for errors
if (createDocumentrequirementResponse == null)
throw new ApplicationException("No response from web service.");
if (!createDocumentrequirementResponse.Success)
throw new ApplicationException(createDocumentrequirementResponse.Message);
// process updateDocumentrequirementResponse.Record
MessageBox.Show(String.Format("documentRequirementId {0} created.",
createDocumentrequirementResponse.Record.documentRequirementId));
}
catch (Exception ex)
{
if (wsClient != null) wsClient.Abort();
MessageBox.Show(ex.Message);
}
}
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
...
This method is used to get document information for an existing document.
To call this method, you need to construct a GetDocumentRequirementRequest object with the following properties:
public SecurityToken SecurityToken { get; set; } // see Creating a Document
public new long? Id { get; set; }
GetDocumentRequirementResponse has the same properties as UpdateDocumentRequirementResponse — see Creating a Document.
Anchor | ||||
---|---|---|---|---|
|
private GetDocumentRequirementResponse GetDocumentRequirementInfo(long documentRequirementId)
{
RegentEnterpriseServiceClient wsClient = null;
GetDocumentRequirementResponse getDocumentRequirementResponse = 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
GetDocumentRequirementRequest getDocumentRequirementRequest = new
GetDocumentRequirementRequest ();
getDocumentRequirementRequest.SecurityToken = securityToken;
getDocumentRequirementRequest.Id = documentRequirementId;
// make call
getDocumentRequirementResponse = wsClient.getDocumentRequirement(getDocumentRequirementRequest);
// check for errors
if (getDocumentRequirementResponse == null)
throw new ApplicationException("No response from web service.");
if (!getDocumentRequirementResponse.Success)
throw new ApplicationException(getDocumentRequirementResponse.Message);
}
catch (Exception ex)
{
if (wsClient != null) wsClient.Abort();
throw ex;
}
return getDocumentRequirementResponse;
}
...
This method is used to get a list of documents, e.g., for a specified student.
To call this method, you need to construct a GetDocumentRequirementListRequest 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
GetDocumentRequirementListResponse has the following properties:
public List<DocumentRequirement> 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; }
Anchor | ||||
---|---|---|---|---|
|
private GetDocumentRequirementListResponse GetDocumentRequirementList(long studentId)
{
RegentEnterpriseServiceClient wsClient = null;
GetDocumentRequirementListResponse getDocumentRequirementListResponse = 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
GetDocumentRequirementListRequest getDocumentRequirementListRequest =
new GetDocumentRequirementListRequest ()
{
SecurityToken = securityToken,
// restrict list to documents for a single student
filterCondition = String.Format("[studentId]={0}", studentId),
sortExpression = "", // optional
startRowIndex = 1,
endRowIndex = 10
};
// make call
getDocumentRequirementListResponse =
wsClient.getDocumentRequirementList(getDocumentRequirementListRequest);
// check for errors
if (getDocumentRequirementListResponse == null)
throw new ApplicationException("No response from web service.");
if (!getDocumentRequirementListResponse.Success)
throw new ApplicationException(getDocumentRequirementListResponse.Message);
}
catch (Exception ex)
{
if (wsClient != null) wsClient.Abort();
throw ex;
}
return getDocumentRequirementListResponse;
}
...
This method is used to update an existing document.
This method takes the same UpdateDocumentRequirementRequest object and returns the same UpdateDocumentRequirementResponse object as createDocumentRequirement() — see Creating a Document. Prior to making updates, the UpdateDocumentRequirementRequest.Record should be populated using getDocumentRequirement() to pick up the current property values— see Getting Document Information. Once populated, change the properties to be updated.
...
private void UpdateDocumentRequirementNotes(long documentRequirementId, string notes)
{
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 document info
GetDocumentRequirementResponse documentRequirementInfo =
GetDocumentRequirementInfo(documentRequirementId);
#region perform update
// set up request
UpdateDocumentRequirementRequest updateDocumentRequirementRequest =
new UpdateDocumentRequirementRequest()
{
SecurityToken = securityToken,
Record = documentRequirementInfo.Record
};
// set the values being updated — LoginId and VersionStamp cannot be updated
// CreatedOn shouldn't be updated
updateDocumentRequirementRequest.Record.Notes = notes;
// make call
UpdateDocumentRequirementResponse updateDocumentRequirementResponse =
wsClient.updateDocumentRequirement(updateDocumentRequirementRequest);
// check for errors
if (updateDocumentRequirementResponse == null)
throw new ApplicationException("No response from web service.");
if (!updateDocumentRequirementResponse.Success)
throw new ApplicationException(updateDocumentRequirementResponse.Message);
#endregion perform update
// process updateLoginResponse.Record
MessageBox.Show(String.Format("{0} updated.",
updateDocumentRequirementResponse.Record.documentRequirementId));
}
catch (Exception ex)
{
if (wsClient != null) wsClient.Abort();
MessageBox.Show(ex.Message);
}
}
Anchor | ||||
---|---|---|---|---|
|
...
This method is used to delete an existing document.
This method takes the same UpdateDocumentRequirementRequest object and returns the same UpdateDocumentRequirementResponse object as createDocumentRequirement () — see Creating a Document.
Anchor | ||||
---|---|---|---|---|
|
private void DeleteDocumentRequirement(long documentRequirementId)
{
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 document info
GetDocumentRequirementResponse documentRequirementInfo =
GetDocumentRequirementInfo(documentRequirementId);
#region perform deletion
// set up request
UpdateDocumentRequirementRequest deleteDocumentRequirementRequest =
new UpdateDocumentRequirementRequest()
{
SecurityToken = securityToken,
Record = documentRequirementInfo.Record
};
// make call
UpdateDocumentRequirementResponse deleteDocumentRequirementResponse =
wsClient.deleteDocumentRequirement(deleteDocumentRequirementRequest);
// check for errors
if (deleteDocumentRequirementResponse == null)
throw new ApplicationException("No response from web service.");
if (!deleteDocumentRequirementResponse.Success)
throw new ApplicationException(deleteDocumentRequirementResponse.Message);
#endregion perform deletion
// process updateLoginResponse.Record
MessageBox.Show(String.Format("{0} deleted.",
deleteDocumentRequirementResponse.Record.documentRequirementId));
}
catch (Exception ex)
{
if (wsClient != null) wsClient.Abort();
MessageBox.Show(ex.Message);
}
}
Anchor | ||||
---|---|---|---|---|
|
...
This method is used to get the external (institution's) IDs associated with a Regent student ID.
To call this method, you need to construct a GetStudentExternalIdsRequest object with the following properties:
public SecurityToken SecurityToken { get; set; }
public StudentExternalIds 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
StudentExternalIds properties:
public Int64 Id { get; set; }
public Int64 LocationId { get; set; }
public String ExternalId1 { get; set; }
public String ExternalId2 { get; set; }
public String ExternalId3 { get; set; }
public String ExternalId4 { get; set; }
GetStudentExternalIdsResponse has the following properties:
public StudentExternalIds 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; }
ValidationResults properties:
public bool IsValid { get; set; }
public ValidationResult[] Results { get; set; }
ValidationResult properties:
public String Property { get; set; }
public String Message { get; set; }
Anchor | ||||
---|---|---|---|---|
|
private void GetStudentExternalIds(long studentId)
{
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
GetStudentExternalIdsRequest getStudentExternalIdsRequest = new GetStudentExternalIdsRequest()
{
SecurityToken = securityToken,
Id = studentId
};
// make call
GetStudentExternalIdsResponse getStudentExternalIdsResponse = wsClient.getStudentExternalIds(getStudentExternalIdsRequest);
// check for errors
if (getStudentExternalIdsResponse == null)
throw new ApplicationException("No response from web service.");
if (!getStudentExternalIdsResponse.Success)
throw new ApplicationException(getStudentExternalIdsResponse.Message);
// process updateDocumentrequirementResponse.Record
var record = getStudentExternalIdsResponse.Record;
string msg = String.Format("External IDs for student ID {0}:" + Environment.NewLine +
"\tExternal ID 1: {1}" + Environment.NewLine +
"\tExternal ID 2: {2}" + Environment.NewLine +
"\tExternal ID 3: {3}" + Environment.NewLine +
"\tExternal ID 4: {4}" + Environment.NewLine,
studentId, record.ExternalId1, record.ExternalId2,
record.ExternalId3, record.ExternalId4);
MessageBox.Show(msg);
}
catch (Exception ex)
{
if (wsClient != null) wsClient.Abort();
MessageBox.Show(ex.Message);
}
}