Using the CloudShare API
You can integrate end user access to a CloudShare virtual lab from directly within your LMS using CloudShare's public API.
The CloudShare sponsoredlinks API call returns a simple token that can be embedded in a web site button link, an email or a text message. When invoked by an end user via LMS or other application, the linked token points to all the information needed to log in to the virtual lab environment.
The CloudShare login token stores information such as:
End user or student name
Company name
Blueprint to be used for the environment
Policy to be used for the environment
Region to be used for the environment (optional)
Name of the inviting person (optional)
Optional contact details, if needed
The login token expires after one day (by default) or after the time period you specify has elapsed.
In order to use the sponsoredlinks API, the following conditions must be met:
You must use a unique Authentication ID in the API header. Obtain this ID from your CloudShare support representative.
Both Blueprint and Policy must be pre-configured in CloudShare before the API is called.
The login token must be invoked with a CloudShare command URL.
API Usage Example
As shown above, integrating your LMS with CloudShare is a simple 3-step process.
-
Create a Login Token. From your REST API platform (or custom script), submit a POST command that passes all required parameters to the sponsoredlinks API:
{ "email": "CosmoSpears@cloudshare.com", "firstName": "Cosmo", "lastName": "Spears", "jobTitle": "manager", "phoneNumber": "0323232454", "company": "cloudshare", "policyId": "POLs3J1NEAESn7ipYMwYq0Q2", "blueprintId": "BPtsTS27hEsHcVZcZsxw2", "useLatestSnapshot": false, "expirationMinutes": 15, "inviterId": "VPBMIHcniyUwPCFmxXZIfqng2", "shouldAskForPassword": true, "regionId": "REKolD1-ab84YIxODeMGob9A2", "allowMultipleUsages": false, "disableEnvironmentAcceptedNotificationMail": false, "disableEnvironmentAcceptedMailToInvitationOwner": false }
The following parameter values should be supplied by the LMS application:
email
firstName
lastName
jobTitle (optional)
phoneNumber (optional)
company
The following parameter values should be supplied by CloudShare:
policyId
blueprintId
regionId (optional)
additional parameters as needed
Numerous optional parameters are provided to enable tweaking of end user access control over the resulting environment. For example, you can enable (or disable) multiple access logins, enable (or disable) user notification emails, generate random access passwords, and more.
For complete information on all parameters used in the sponsoredlinks API, click here.
When the POST submission is successful, the API provides a response like this one:
{ "loginToken": "x7467hqyWI", "envId": null, "isLoginRequired": false }
Copy the Token. As shown above, copy the
loginToken
value that is provided in the API response.-
Use the Token. Append the
loginToken
value to the CloudShare command URL as shown, and embed this URL in the relevant LMS application (e.g., web page button, invitation email, text message, etc.) for execution by the invited end user, for example:https://use.cloudshare.com/Ent/Login.mvc/SponsoredLogin?token=x7467hqyWI
When executed, the URL creates a new environment instance or accesses the relevant environment instance if it already exists. Then it logs the invited end user in to that environment.
Additional APIs
CloudShare provides additional APIs that support use of the sponsoredlinks API:
-
OPTIONS /api/v3/sponsoredlinks
This API filters for a currently active list of the following parameters, according to the options entered:
projectName
blueprintName
policyName
The resulting values can then be used as input for a subsequent sponsoredlinks POST command. For complete information, click here.
-
GET /api/v3/projects/{PROJECT_ID}/policies
GET /api/v3/projects/{PROJECT_ID}/blueprints
GET /api/v3/regions
These are Class-level configuration calls that produce currently active values for each relevant endpoint. (Each Class returns a specific list of values.)
The resulting values can be used as input for a subsequent sponsoredlinks POST command. For complete information, locate the desired endpoint here.
Using a REST Interface (API V3)
You can also invoke the sponsoredlinks API using custom functions inside C#, JavaScript, Python and Go scripts. For complete information about using our REST SDK, click here.
Comments
0 comments
Article is closed for comments.