Custom Field Endpoint

Get

This method returns a Custom Field.

Get/api/customfields/{customfieldid}

The URL must have the Custom Field Id. It returns the CustomFieldDto.

Microsoft.NET example:

CustomFieldDto customField = serviceManager.CustomFields.Get(22);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/customfields/22";
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 Custom Fields.

Get/api/customfields

It returns a list of CustomFieldDto's.

Microsoft.NET example:

List<CustomFieldDto> customFields = serviceManager.CustomFields.Get();

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/customfields";
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 Custom Field.

POST/api/customfields

The request body must contain the CustomField entity. The return value is the new CustomFieldDto where the Custom Field Id is populated.

Microsoft.NET example:

var field = new CustomField();

field.Name = "Freetext";
field.ScreenDescription = "Enter any comments";
field.ScreenLabel = "Freetext";
field.ScreenTooltip = "Freetext";
field.Type = "T";
field.TemplateId = 10;

serviceManager.CustomFields.Create(field);

JavaScript example:

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

var geminiData = {
                  Name: "Freetext",
                  ScreenDescription: "Enter any comments",
                  ScreenLabel: "Freetext",
                  ScreenTooltip: "Freetext",
                  Type: "T",
                  TemplateId: "10"
                 };

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

Update

This method updates an existing Custom Field.

PUT/api/customfields

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

Microsoft.NET example:

CustomFieldDto field = new CustomFieldDto();

field.Entity.Id = 77;
field.Entity.Name = "Restricted Textfield";
field.Entity.ScreenDescription = "Enter any comments";
field.Entity.ScreenLabel = "Freetext";
field.Entity.ScreenTooltip = "Freetext";
field.Entity.Type = "T";
field.Entity.TemplateId = 10;

serviceManager.CustomFields.Update(field.Entity);

JavaScript example:

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

var geminiData = {
    Id: "77",
    Name: "Restricted Textfield",
    ScreenDescription: "Enter any comments",
    ScreenLabel: "Freetext",
    ScreenTooltip: "Freetext",
    Type: "T",
    TemplateId: "10"
};

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

Delete

This method deletes a Custom Field

DELETE/api/customfields/{customfieldid}

The URL must contain the CustomField Id.

Microsoft.NET example:

CustomFieldManager customfieldManager = new CustomFieldManager();
customfieldManager.Delete(77);

JavaScript example:

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

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

Insert Lookup Row

This method inserts a new row for the custom field's lookup table.

POST/api/customfieldslookup

The request body must contain the CustomFieldLookupDataId entity.

Microsoft.NET example:

var lookup = new CustomFieldLookupDataId();
lookup.CustomFieldId = 12;
lookup.Key = "1";
lookup.Value = "USA";
serviceManager.CustomFields.InsertLookupRow(field);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/customfieldslookup";
var geminiLogin = Base64.encode("manager:xvitjc5bmm"); // user:apikey
var geminiData = {
                  CustomFieldId: 12,
                  Key: "1",
                  Value: "USA"
                 };
$.ajax({
    url: geminiUrl,
    type: "POST",
    data: geminiData,
    headers: { "Authorization": "Basic " + geminiLogin },
    success: function (data) {
      alert('Success!');
    }
});

Update Lookup Row

This method updates a row for the custom field's lookup table.

PUT/api/customfieldslookup

The request body must contain the CustomFieldLookupDataId entity.

Microsoft.NET example:

var lookup = new CustomFieldLookupDataId();
lookup.CustomFieldId = 12;
lookup.Key = "1";
lookup.Value = "United States of America";
serviceManager.CustomFields.UpdateLookupRow(field);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/customfieldslookup";
var geminiLogin = Base64.encode("manager:xvitjc5bmm"); // user:apikey
var geminiData = {
                  CustomFieldId: 12,
                  Key: "1",
                  Value: "United States of America"
                 };
$.ajax({
    url: geminiUrl,
    type: "PUT",
    data: geminiData,
    headers: { "Authorization": "Basic " + geminiLogin },
    success: function (data) {
      alert('Success!');
    }
});

Delete Lookup Row

This method delete a row from the custom field's lookup table.

DELETE/api/customfieldslookup/{customfieldid}/{rowid}

The url must contain the custom field id and row id to delete.

Microsoft.NET example:

serviceManager.CustomFields.DeleteLookupRow(12, "1");

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/customfieldslookup/12/1";
var geminiLogin = Base64.encode("manager:xvitjc5bmm"); // user:apikey
$.ajax({
    url: geminiUrl,
    type: "DELETE",
    headers: { "Authorization": "Basic " + geminiLogin },
    success: function (data) {
      alert('Success!');
    }
});