Authentication
You can access Gemini either using the pre-built .NET Client API assembly or by
directly invoking the REST Gemini Web Services.
.NET Client API
Authenticating with Gemini using the .NET Client API is straightforward and
involves constructing a ServiceManager object:
ServiceManager serviceManager = new ServiceManager(url, username, password, apiKey, windowsAuthentication);
The ServiceManager will automatically Base64 encod Username and API Key value.
The ServiceManager will automatically MD5 hash the Password.
Authenticate using Gemini Username/Password combination:
ServiceManager serviceManager = new ServiceManager("http://gemini.server.com", "my_username", "my_password", "", false);
Authenticate using Gemini Username/API Key combination:
ServiceManager serviceManager = new ServiceManager("http://gemini.server.com", "my_username", "", "my_api_key", false);
Each user can obtain their API Key from within Gemini → My Profile section.
Authenticate using Windows Authentication:
ServiceManager serviceManager = new ServiceManager("http://gemini.server.com", "", "", "", true);
Assumption: Gemini is also confgiured to use Windows Authentication.
REST Web Services
When communicating directly with Gemini Web Services (not using the forementioned
.NET Client API assembly, HTTP Headers must be set in order to authenticate with
Gemini.
The available HTTP Header values are as follows:
gemini-username-token
gemini-password-token
gemini-api-token
If you are using Windows Authentication, the above three tokens should be
omitted.
Username and API tokens must be Base64 encoding.
Password token must be MD5 hashed.
JavaScript example (using JQuery) that will authenticate with Gemini and retreive a list of Projects :
var geminiUrl = "http://sandbox.countersoft.com/";
var geminiUsername = Base64.encode("manager"); // should result in "bWFuYWdlcg==" value
var geminiApiKey = Base64.encode("zq7rdtuzx3"); // should result in "d3ZkYjJkeTIyNw==" value
$(document).ready(function() {
$("#getProjects").click(function() {
jQuery.getJSON(geminiUrl + "api/projects.ashx/projects?format=json&gemini-username-token="
+ geminiUsername + "&gemini-api-token=" + geminiApiKey + "&callback=?",
function(data)
{
//alert(data);
$("#divProjects").html(parseTemplate($("#ProjectsTemplate").html(), { projects: data }));
});
});
});
...should result in the following HTTP Headers:
gemini-username-token: bWFuYWdlcg==
gemini-api-token: d3ZkYjJkeTIyNw==
gemini-password-token
|