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 datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


class PossibleComparisons(str, Enum):
    LTE = 'LTE'
    LT = 'LT'
    GT = 'GT'
    GTE = 'GTE'
    EQ = 'EQ'
    NE = 'NE'
    NULL = 'NULL'
    NOTNULL = 'NOTNULL'
    CHG = 'CHG'
    STARTS = 'STARTS'
    LIKE = 'LIKE'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Condition:
    value_compared_to: Optional[str] = None
    value_to_compare: Optional[str] = None
    comparison_operator: Optional[PossibleComparisons] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ConditionGroup:
    condition: Optional[Condition] = None
    precedence: int = 0
    group_identifier: int = 0
    boolean_operator: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ConditionGroupItem:
    condition_groups: Optional[List[ConditionGroup]] = None
    precedence: int = 0
    group_identifier: int = 0
    boolean_operator: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Action:
    id: Optional[str] = None
    call_type: Optional[str] = None
    action_to_take: Optional[str] = None
    destination: Optional[str] = None
    external_id: Optional[str] = None
    external_parent_id: Optional[str] = None
    delete_type_if_not_exists: Optional[str] = None
    data_tree: Optional[Dict[str, Object]] = None
    data: Optional[str] = None
    data_types: Optional[Dict[str, Object]] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RuleModuleDefinition:
    is_output_module: bool = False
    name: Optional[str] = None
    prerequisites: Optional[List[str]] = None
    parameters: Optional[Dict[str, Object]] = None
    type: Optional[str] = None
    output_action: Optional[Action] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class 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.
    """

    workspace_id: Optional[str] = None
    name: Optional[str] = None
    data: Optional[Dict[str, Object]] = None
    object_type: Optional[str] = None
    id: Optional[str] = None
    condition_group_items: Optional[List[ConditionGroupItem]] = None
    actions_to_take: Optional[List[Action]] = None
    last_updated: datetime.datetime = datetime.datetime(1, 1, 1)
    module_pipeline: Optional[List[RuleModuleDefinition]] = None
    enabled: bool = False
    workday_restricted: bool = False
    teams: Optional[List[str]] = None
    allow_programmatic_trigger: bool = False

Python IntegrationRule DTOs

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

HTTP + XML

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: application/xml
Content-Type: application/xml
Content-Length: length

<IntegrationRule xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
  <ActionsToTake>
    <Action>
      <ActionToTake>String</ActionToTake>
      <CallType>String</CallType>
      <Data>String</Data>
      <DataTree xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringanyType>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value />
        </d4p1:KeyValueOfstringanyType>
      </DataTree>
      <DataTypes xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringanyType>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value />
        </d4p1:KeyValueOfstringanyType>
      </DataTypes>
      <DeleteTypeIfNotExists>String</DeleteTypeIfNotExists>
      <Destination>String</Destination>
      <ExternalId>String</ExternalId>
      <ExternalParentId>String</ExternalParentId>
      <Id>String</Id>
    </Action>
  </ActionsToTake>
  <AllowProgrammaticTrigger>false</AllowProgrammaticTrigger>
  <ConditionGroupItems>
    <ConditionGroupItem>
      <BooleanOperator>String</BooleanOperator>
      <ConditionGroups>
        <ConditionGroup>
          <BooleanOperator>String</BooleanOperator>
          <Condition>
            <ComparisonOperator>LTE</ComparisonOperator>
            <ValueComparedTo>String</ValueComparedTo>
            <ValueToCompare>String</ValueToCompare>
          </Condition>
          <GroupIdentifier>0</GroupIdentifier>
          <Precedence>0</Precedence>
        </ConditionGroup>
      </ConditionGroups>
      <GroupIdentifier>0</GroupIdentifier>
      <Precedence>0</Precedence>
    </ConditionGroupItem>
  </ConditionGroupItems>
  <Data xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringanyType>
      <d2p1:Key>value</d2p1:Key>
      <d2p1:Value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">String</d2p1:Value>
    </d2p1:KeyValueOfstringanyType>
  </Data>
  <Enabled>false</Enabled>
  <Id>String</Id>
  <LastUpdated>0001-01-01T00:00:00</LastUpdated>
  <ModulePipeline xmlns:d2p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.Integration">
    <d2p1:RuleModuleDefinition>
      <d2p1:IsOutputModule>false</d2p1:IsOutputModule>
      <d2p1:Name>String</d2p1:Name>
      <d2p1:OutputAction>
        <ActionToTake>String</ActionToTake>
        <CallType>String</CallType>
        <Data>String</Data>
        <DataTree xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringanyType>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value />
          </d5p1:KeyValueOfstringanyType>
        </DataTree>
        <DataTypes xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringanyType>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value />
          </d5p1:KeyValueOfstringanyType>
        </DataTypes>
        <DeleteTypeIfNotExists>String</DeleteTypeIfNotExists>
        <Destination>String</Destination>
        <ExternalId>String</ExternalId>
        <ExternalParentId>String</ExternalParentId>
        <Id>String</Id>
      </d2p1:OutputAction>
      <d2p1:Parameters xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringanyType>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value />
        </d4p1:KeyValueOfstringanyType>
      </d2p1:Parameters>
      <d2p1:Prerequisites xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:Prerequisites>
      <d2p1:Type>String</d2p1:Type>
    </d2p1:RuleModuleDefinition>
  </ModulePipeline>
  <Name>String</Name>
  <ObjectType>String</ObjectType>
  <Teams xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:string>String</d2p1:string>
  </Teams>
  <WorkdayRestricted>false</WorkdayRestricted>
  <WorkspaceId>String</WorkspaceId>
  <_data>String</_data>
</IntegrationRule>