Organization Endpoint

Get

This method returns an organization.

Get/api/organizations/{id}

The URL must have the Organization Id. It returns the Organization Entity.

Microsoft.NET example:

var organization = serviceManager.Groups.GetOrganization(2);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/organizations/2";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "GET",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function (data) {
      alert('Success!');
    }
});

Get All

This method returns all organizations.

Get/api/organizations

It returns a list of Organization Entities.

Microsoft.NET example:

List<Countersoft.Gemini.Commons.Entity.Security.Organization> organizations = serviceManager.Groups.GetOrganizations();

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/organizations";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "GET",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function (data) {
      alert('Success!');
    }
});

Create

This method creates a new organization.

POST/api/organizations

The request body must contain the Organization entity. The return value is the new Organization entity where the Organization Id field is populated.

Microsoft.NET example:

Countersoft.Gemini.Commons.Entity.Security.Organization organization = new Countersoft.Gemini.Commons.Entity.Security.Organization();

organization.Name = "Administrator";
organization.Description = "Department Administrator";

serviceManager.Groups.CreateOrganizations(organization);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/organizations";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey
var geminiData = {
    Name: "Administrator",
    description: "Department Administrator",
};

$.ajax({
    url: geminiUrl,
    type: "POST",
    data: geminiData,
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function (data) {
        alert('Success!');
    }
        });

Update

This method updates an existing organization.

PUT/api/organizations

The request body must contain the Organization entity including the Id. The return value is the updated Organization entity.

Microsoft.NET example:

Countersoft.Gemini.Commons.Entity.Security.Organization organization = new Countersoft.Gemini.Commons.Entity.Security.Organization();

organization.Id = 12;
organization.Name = "Administrator";
organization.Description = "General Administrator";

login.Groups.UpdateOrganizations(organization);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/organizations";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey
var geminiData = {
                  Id: "12",
                  Name: "Administrator",
                  description: "General Administrator",      
                 };

$.ajax({
    url: geminiUrl,
    type: "PUT",
    data: geminiData,
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function (data) {
        alert('Success!');
    }
});

Delete

This method deletes an organization.

DELETE/api/organizations/{id}

The URL must contain the Organization Id.

Microsoft.NET example:

serviceManager.Groups.DeleteOrganizations(12);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/organizations/12";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "DELETE",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function () {
        alert('Success!');
    }
});

Join Organization

This method add an user into an organization.

DELETE/api/organizations/{id}/join/{userId}

The URL must contain the Organization Id and User Id.

Microsoft.NET example:

serviceManager.Groups.JoinOrganization(12, 2);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/organizations/12/join/2";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "DELETE",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function () {
        alert('Success!');
    }
});

Leave Organization

This method deletes an user from an organization.

DELETE/api/organizations/{id}/leave/{userId}

The URL must contain the Organization Id and User Id.

Microsoft.NET example:

serviceManager.Groups.LeaveOrganization(12, 2);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/organizations/12/leave/2";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "DELETE",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function () {
        alert('Success!');
    }
});