Project Component Endpoint
Get
This method returns a Component.
Get/api/projects/{projectid}/components/{componentid}
The URL must have the Project Id and Component Id. It returns the ComponentDto.
Microsoft.NET example:
ComponentDto component = serviceManager.Projects.GetComponent(10, 34);
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/projects/10/components/34"; 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 Components for a specific Project.
Get/api/projects/{projectid}/components
It returns a list of ComponentsDto's.
Microsoft.NET example:
List<ComponentDto> components = serviceManager.Projects.GetComponents(10);
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/projects/10/components"; 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 Component.
POST/api/projects/{projectid}/components
The request body must contain the Project Component entity. The return value is the new ComponentDto where the Component Id field is populated.
Microsoft.NET example:
var component = new Component(); component.Name = "Billing"; component.Description = "Raising quotations and generating invoices"; component.ProjectId = 10; component.Lead = 2; serviceManager.Projects.CreateComponent(component);
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/projects/17/components"; var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey var geminiData = { Name: "Billing", Description: "Raising quotations and generating invoices", ProjectId: "17", Lead: "1" }; $.ajax({ url: geminiUrl, type: "POST", data: geminiData, headers: { "Authorization": "Basic " + geminiUsername }, success: function (data) { alert('Success!'); } });
Update
This method updates an existing component.
PUT/api/projects/{projectid}/components
The request body must contain the Project Component entity including the Id. The return value is the updated ComponentDto.
Microsoft.NET example:
ComponentDto component = new ComponentDto(); component.Entity.Name = "Billing"; component.Entity.Description = "Raising quotations only"; component.Entity.Lead = 1; component.Entity.ProjectId = 17; component.Entity.Id = 10; serviceManager.Projects.UpdateComponent(component.Entity);
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/projects/17/components"; var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey var geminiData = { Id: "76", Name: "Billing", Description: "Raising quotations and generating invoices", ProjectId: "17", Lead: "1" }; $.ajax({ url: geminiUrl, type: "PUT", data: geminiData, headers: { "Authorization": "Basic " + geminiUsername }, success: function (data) { alert('Success!'); } });
Delete
This method deletes a Component
DELETE/api/projects/{projectid}/components/{componentid}
The URL must contain the Project Id and the Component Id.
Microsoft.NET example:
serviceManager.Projects.DeleteComponent(17, 76);
JavaScript example:
var geminiUrl = "http://localhost/gemini/api/projects/17/components/76"; var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey $.ajax({ url: geminiUrl, type: "DELETE", headers: { "Authorization": "Basic " + geminiUsername }, success: function () { alert('Success!'); } });