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}
import Foundation
import ServiceStack

/**
* 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.
*/
public class IntegrationRule : Codable
{
    public var workspaceId:String
    public var name:String
    public var data:[String:Object] = [:]
    public var objectType:String
    public var id:String
    public var conditionGroupItems:[ConditionGroupItem] = []
    public var actionsToTake:[Action] = []
    public var lastUpdated:Date
    public var modulePipeline:[RuleModuleDefinition] = []
    public var enabled:Bool
    public var workdayRestricted:Bool
    public var teams:[String] = []
    public var allowProgrammaticTrigger:Bool

    required public init(){}
}

public class ConditionGroupItem : Codable
{
    public var conditionGroups:[ConditionGroup] = []
    public var `precedence`:Int
    public var groupIdentifier:Int
    public var booleanOperator:String

    required public init(){}
}

public class ConditionGroup : Codable
{
    public var condition:Condition
    public var `precedence`:Int
    public var groupIdentifier:Int
    public var booleanOperator:String

    required public init(){}
}

public class Condition : Codable
{
    public var valueComparedTo:String
    public var valueToCompare:String
    public var comparisonOperator:PossibleComparisons

    required public init(){}
}

public enum PossibleComparisons : String, Codable
{
    case LTE
    case LT
    case GT
    case GTE
    case EQ
    case NE
    case NULL
    case NOTNULL
    case CHG
    case STARTS
    case LIKE
}

public class Action : Codable
{
    public var id:String
    public var callType:String
    public var actionToTake:String
    public var destination:String
    public var externalId:String
    public var externalParentId:String
    public var deleteTypeIfNotExists:String
    public var dataTree:[String:Object] = [:]
    public var data:String
    public var dataTypes:[String:Object] = [:]

    required public init(){}
}

public class RuleModuleDefinition : Codable
{
    public var isOutputModule:Bool
    public var name:String
    public var prerequisites:[String] = []
    public var parameters:[String:Object] = [:]
    public var type:String
    public var outputAction:Action

    required public init(){}
}


Swift 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
}