For all methods apply:
	
private const string Authdomain = "https://auth.exorlive.com";
private const string ExorLiveAppDomain = "https://exorlive.com";

// Append the access token to the request.
var header = new Dictionary<string, string>
{
	{"Authorization", String.Format("Bearer {0}", accessToken)}
};
	

GetListOfUsers

Gets all the users in the organization.

You may filter on the users role:

  • 0: all.
  • 8: Instructor
  • 16: Contact with a login.
  • 32: Contact without a login.

UnitId=0, unless you want to filter on departments within your organization.

Page=0 means first page of results.

Pagesize must be a positive number.

C# sample code:
					
var data = new Dictionary<string, string>
{
	{"unitId", "0"},
	{"role", "0"},
	{"page", "0"},
	{"pagesize", "1000"}
};
var reqUri = ExorLiveAppDomain + "/WebServices/V1/Persons.svc/GetListOfUsers";
var response = WebMsg(reqUri, "POST", data, "application/json; charset=utf-8", header);
				
			

SetCustomId

Will update the user in ExorLive with your Id, called the CustomId. You need to know the ExorLive User Id first. It may be found using the GetListOfUsers method. C# sample code:
					
var data = new Dictionary<string, string>
{
	{"personId", userId.ToString()},
	{"customId", "MyNewCustomId"}
};
var reqUri = ExorLiveAppDomain + "/WebServices/V1/Persons.svc/SetCustomId";
var response = WebMsg(reqUri, "POST", data, "application/json; charset=utf-8", header);
						
				

ResolveCustomId

Use this method to lookup users in ExorLive based on the ID of the user in the partner application.

Will return 0, if not found, otherwise the ExorLive User Id of this user or contact.

The ID from the partner application is called "CustomId" in ExorLive

C# sample code:
					
var data = new Dictionary<string, string>
{
	{"customId", mrmId}
};
var reqUri = ExorLiveAppDomain + "/WebServices/V1/Persons.svc/ResolveCustomId";
var response = WebMsg(reqUri, "POST", data, "application/json; charset=utf-8", header);

// Parse the result.
var userIdHolder = JsonConvert.DeserializeObject<dynamic>(response); // Deserialize the JSON to a dynamic object
int userId = (int)userIdHolder.d.Data;
					
				

SetPersonDetails

Create or update a user. ExorLive User Id is the identifier. Id=0 creates a new user object in ExorLive. Lookup the Id with ResolveCustomId() before calling this method. The return value is the ExorLive User Id.

The 'Type' and 'IsActivated' is important when creating a new user. Fo existing users (id <> 0) these parameters are ignored.

Types:
  • Type=2 - create an administrator (includes instructor role)
  • Type=8 - create an instructor
  • Type=16 - create a contact with login
  • Type=0 - create a contact without login

IsActivated:
(Only applicable if Type > 0 - i.e. the user shall be able to log in)
  • IsActivated=1
    The user is immediately activated. It does not have username/password and my only be logged in through the API.

  • IsActivated=0
    The user is NOT activated and may not login until activated at a later stage. ExorLive will immediately send an email to the user (if an email address was provided) with a link to specify a username and password and self-activate the account.
(It is also possible in the ExorLive administration tab to trigger an activation email) C# sample code:
	
var data = new
{
	person = new
	{
		Id = 0,                           // The ExorLive User Id, or 0 to create a new user
		CustomId = txtMrmId.Text,
		Firstname = txtFirstname.Text,
		Lastname = txtLastname.Text,
		Email = txtEmail.Text,
		IsActivated = 1,                   // Must be set to 1 to create and immediately activate this user.
		                                   // Must be set to 0 to activate the user through an email.
		Address = "",
		Location = "",
		Zipcode = "",

		Comment = "User created by MRM",  // Comment about this clients training.
		Companyname = "",                 // The employer of this client.
		CultureString = "nb-NO",          // The 5-letter code for the language. 
	                                      // Leave blank for the default language in the browser.
	                                      // Supported langauges are : nb-NO, sv-SE, da-DK, fi-FI, en-US
		DateOfBirth = "1947-07-30",       // Leave blank, or make sure it is a valid date in the format YYYY-mm-DD
		Type = 16,                        // Leave '16', to make this user a 'contact with login'. 
	                                      // Set to 8 to make it an instructor.
		DepartmentId = 0,                 // Use if the organization has sub-departments.
		Description = "A test-user",      // Who is this person
		Height = 0,                       // integer. Height in cm.
		Phone1 = "",                      // Home phone number
		Phone2 = "",                      // Mobile phonenumber
		Phone3 = "",                      // Work phone number
		PrimaryContact = _exorLiveInstructorUserId, // The user id of the instructor that 'owns' this contact. 
	                                                // May be the logged in instructor, or another user id.
	                                                // Use this field primarily for contacts, otherwise 0.
		Sex = 1,                          // 0: unknown, 1: male, 2: female
		Web = "",                         // a URL, if the user has a webpage.
		Weight = 0,                       // Weight of the user, in KG.
		WeightGoal = 0                    // The Weight goal, if the goal of the client is to reduce weight.
	}
};
var reqUri = ExorLiveAppDomain + "/WebServices/V1/Persons.svc/SetPersonDetails";
var response = WebMsg(reqUri, "POST", data, "application/json; charset=utf-8", header);

// Deserialize the JSON to a dynamic object
var userIdHolder = JsonConvert.DeserializeObject<dynamic>(response); 
int userId = (int)userIdHolder.d.Data;
	

GetPersonDetails

Get details about one user. ExorLive User Id is the identifier. Lookup the ID with ResolveCustomId() before calling this method.

C# sample code:
			
var data = new Dictionary<string, string>
{
	{"personId", userId.ToString()}
};
var reqUri = ExorLiveAppDomain + "/WebServices/V1/Persons.svc/GetPersonDetails";
var response = WebMsg(reqUri, "POST", data, "application/json; charset=utf-8", header);
			
		

GetListOfDepartments

Gets all departments and their hierarchy in the Organization. Useful for getting the "DepartmentId" that you may need for SetPersonDetails().

C# sample code:
	
var reqUri = ExorLiveAppDomain + "/WebServices/V1/Core.svc/GetListOfDepartments";
var response = WebMsg(reqUri, "POST", "{}", "application/json; charset=utf-8", header);
	

SetUserDisabled

Turn on or off access for a given user by disabling or enabling it.

Disabled:

  • 0: Enable access for the given user/contact.
  • 1: Disable access for the given user/contact.
C# sample code:
			
var data = new
{
	{"personId", "1234"},
	{"disabled", "1"}
};

var reqUri = ExorLiveAppDomain + "/WebServices/V1/Persons.svc/SetUserDisabled";
var response = WebMsg(reqUri, "POST", data, "application/json; charset=utf-8", header);
			
		

QueryWorkouts

Get a list of workouts.

Location:

  • 0: All workouts in the organization.
  • 1: Workouts belonging to the given user (instructor/contact)

LocationId: The ExorLive ID of the user, if Location=1

Query: Leave blank, unless you want to do a freetext search filter within the applicable workouts.

Nested: Always 1

Start: 0, unless you are using paging. (To get page 2, and you want a pagesize of 30: Start=30, Length=30)

Length: Max number of workouts to get. Use paging to get more than that number.

OnlyTemplates: 0 = all, 1 = your want to get templates only, i.e. workouts not assigned to a contact.

C# sample code:
			
var data = new
{
	query = new
	{
		Location = "1",
		LocationId = contactUserId,
		Query = "",
		Nested = "1",
		Start = "0",
		Length = "1000",
		OnlyTemplates = "0"
	}
};
var reqUri = ExorLiveAppDomain + "/WebServices/V1/Workouts.svc/QueryWorkouts";
var response = WebMsg(reqUri, "POST", data, "application/json; charset=utf-8", header);
			
		

GetWorkout

Get all the details of one workout

C# sample code:
			
var data = new Dictionary<string, string>
{
	{"id", workout.id.ToString()}
};
var reqUri = ExorLiveAppDomain + "/WebServices/V1/Workouts.svc/GetWorkout";
var response = WebMsg(reqUri, "POST", data, "application/json; charset=utf-8", header);
			
		

GetProfile

Get details about the current user.

C# sample code:
			
var reqUri = ExorLiveAppDomain + "/WebServices/V1/Core.svc/GetProfile";
var response = WebMsg(reqUri, "POST", null, "application/json; charset=utf-8", header);