Please note that this code is for demonstration purposes only and is not meant to be used in a production enviornment.

Copy/Paste at your own risk!

function GetPartnerById(id) {
	
	var baseAddress = 'https://connect.aegispremier.com/api';
	var context = 'Please contact Aegis Premier Technologies if you have not yet been assigned a Context variable.';
	var logInCredentials = 'AegisCRMUserName@example.com:AegisCRMPassword';
	var authorization = "Basic " + btoa(logInCredentials);
	
	jQuery.support.cors = true;	
	$.ajax({
		url: baseAddress + '/' + context + '/partner/' + id,
		type: 'GET',
		dataType: 'json',
		headers: { "Authorization", authorization },
		success: function (data) {                
			alert(data.ID + '\n' + data.FirstName + '\n' + data.LastName);
		},
		error: function (x, y, z) {
			alert(x + '\n' + y + '\n' + z);
		}
	});        
}

function Login(partnerUserName, partnerPassword) {

	var baseAddress = 'https://connect.aegispremier.com/api';
	var context = 'Please contact Aegis Premier Technologies if you have not yet been assigned a Context variable.';
	var logInCredentials = 'AegisCRMUserName@example.com:AegisCRMPassword';
	var authorization = "Basic " + btoa(logInCredentials);
	
	var partnerLogInCredentials = { 
		UserName: partnerUserName, 
		Password: partnerPassword
	}; 
	
	jQuery.support.cors = true;
	$.ajax({
		url: baseAddress + '/' + context + '/partner/' + id,
		type: 'POST',
		data: JSON.stringify(partnerLogInCredentials), 
		contentType: "application/json;charset=utf-8", 
		headers: { "Authorization", authorization },
		success: function (data) {
			alert(data.ID + '\n' + data.FirstName + '\n' + data.LastName);
		},
		error: function () {
			alert('Error logging in the partner');
		}
	});
}