Field Squared API Services

<back to all web services

IntegrationRule

Represents a set of rules what the system reads to take a particular set of actions. These dtos allow transfer of that data from the client to the server and vice versa.

The following routes are available for this service:
GET,PUT,DELETE/{WorkspaceId}/IntegrationRule/{Id}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using Field2Office.API.Model;
using Field2Office.API.Model.Integration;

namespace Field2Office.API.Model
{
    public partial class Action
    {
        public Action()
        {
            DataTree = new Dictionary<string, Object>{};
            DataTypes = new Dictionary<string, Object>{};
        }

        public virtual string Id { get; set; }
        public virtual string CallType { get; set; }
        public virtual string ActionToTake { get; set; }
        public virtual string Destination { get; set; }
        public virtual string ExternalId { get; set; }
        public virtual string ExternalParentId { get; set; }
        public virtual string DeleteTypeIfNotExists { get; set; }
        public virtual Dictionary<string, Object> DataTree { get; set; }
        public virtual string Data { get; set; }
        public virtual Dictionary<string, Object> DataTypes { get; set; }
    }

    public partial class Condition
    {
        public virtual string ValueComparedTo { get; set; }
        public virtual string ValueToCompare { get; set; }
        public virtual PossibleComparisons ComparisonOperator { get; set; }
        public enum PossibleComparisons
        {
            LTE,
            LT,
            GT,
            GTE,
            EQ,
            NE,
            NULL,
            NOTNULL,
            CHG,
            STARTS,
            LIKE,
        }

    }

    public partial class ConditionGroup
    {
        public virtual Condition Condition { get; set; }
        public virtual int Precedence { get; set; }
        public virtual int GroupIdentifier { get; set; }
        public virtual string BooleanOperator { get; set; }
    }

    public partial class ConditionGroupItem
    {
        public ConditionGroupItem()
        {
            ConditionGroups = new List<ConditionGroup>{};
        }

        public virtual List<ConditionGroup> ConditionGroups { get; set; }
        public virtual int Precedence { get; set; }
        public virtual int GroupIdentifier { get; set; }
        public virtual string BooleanOperator { get; set; }
    }

    ///<summary>
    ///Represents a set of rules what the system reads to take a particular set of actions. These dtos allow transfer of that data from the client to the server and vice versa.
    ///</summary>
    public partial class IntegrationRule
    {
        public IntegrationRule()
        {
            Data = new Dictionary<string, Object>{};
            ConditionGroupItems = new List<ConditionGroupItem>{};
            ActionsToTake = new List<Action>{};
            ModulePipeline = new List<RuleModuleDefinition>{};
            Teams = new List<string>{};
        }

        public virtual string WorkspaceId { get; set; }
        public virtual string Name { get; set; }
        public virtual Dictionary<string, Object> Data { get; set; }
        public virtual string ObjectType { get; set; }
        public virtual string Id { get; set; }
        public virtual List<ConditionGroupItem> ConditionGroupItems { get; set; }
        public virtual List<Action> ActionsToTake { get; set; }
        public virtual DateTime LastUpdated { get; set; }
        public virtual List<RuleModuleDefinition> ModulePipeline { get; set; }
        public virtual bool Enabled { get; set; }
        public virtual bool WorkdayRestricted { get; set; }
        public virtual List<string> Teams { get; set; }
        public virtual bool AllowProgrammaticTrigger { get; set; }
    }

}

namespace Field2Office.API.Model.Integration
{
    public partial class RuleModuleDefinition
    {
        public RuleModuleDefinition()
        {
            Prerequisites = new List<string>{};
            Parameters = new Dictionary<string, Object>{};
        }

        public virtual bool IsOutputModule { get; set; }
        public virtual string Name { get; set; }
        public virtual List<string> Prerequisites { get; set; }
        public virtual Dictionary<string, Object> Parameters { get; set; }
        public virtual string Type { get; set; }
        public virtual Action OutputAction { get; set; }
    }

}

C# IntegrationRule DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

PUT /{WorkspaceId}/IntegrationRule/{Id} HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	WorkspaceId: String,
	Name: String,
	Data: 
	{
		value: String
	},
	ObjectType: String,
	Id: String,
	ConditionGroupItems: 
	[
		{
			ConditionGroups: 
			[
				{
					Condition: 
					{
						ValueComparedTo: String,
						ValueToCompare: String,
						ComparisonOperator: LTE
					},
					Precedence: 0,
					GroupIdentifier: 0,
					BooleanOperator: String
				}
			],
			Precedence: 0,
			GroupIdentifier: 0,
			BooleanOperator: String
		}
	],
	ActionsToTake: 
	[
		{
			Id: String,
			CallType: String,
			ActionToTake: String,
			Destination: String,
			ExternalId: String,
			ExternalParentId: String,
			DeleteTypeIfNotExists: String,
			DataTree: 
			{
				String: {}
			},
			Data: String,
			DataTypes: 
			{
				String: {}
			}
		}
	],
	LastUpdated: 0001-01-01,
	ModulePipeline: 
	[
		{
			IsOutputModule: False,
			Name: String,
			Prerequisites: 
			[
				String
			],
			Parameters: 
			{
				String: {}
			},
			Type: String,
			OutputAction: 
			{
				Id: String,
				CallType: String,
				ActionToTake: String,
				Destination: String,
				ExternalId: String,
				ExternalParentId: String,
				DeleteTypeIfNotExists: String,
				DataTree: 
				{
					String: {}
				},
				Data: String,
				DataTypes: 
				{
					String: {}
				}
			}
		}
	],
	Enabled: False,
	WorkdayRestricted: False,
	Teams: 
	[
		String
	],
	AllowProgrammaticTrigger: False
}