Field Squared API Services

<back to all web services

InventoryItemTemplate

The following routes are available for this service:
GET,PUT,POST,DELETE/{Workspace}/InventoryItemTemplate
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 CustomFieldDataType(str, Enum):
    TEXT = 'Text'
    NUMBER = 'Number'
    DECIMAL = 'Decimal'
    MONEY = 'Money'
    PHONE_NUMBER = 'PhoneNumber'
    SSN = 'Ssn'
    LIST = 'List'
    DATE = 'Date'
    FILE = 'File'
    BARCODE = 'Barcode'
    GPS = 'GPS'
    PHOTO = 'Photo'
    SPACER = 'Spacer'
    SEPARATOR = 'Separator'
    AUTO_NUMBER = 'AutoNumber'
    TEXT_AREA = 'TextArea'
    CONTACT = 'Contact'
    USER = 'User'
    ASSET = 'Asset'
    CHECKBOX = 'Checkbox'
    CORE_ASSET_LIST = 'CoreAssetList'
    CORE_TASK_LIST = 'CoreTaskList'
    CORE_PARENT_TASK = 'CoreParentTask'
    CORE_CONTACT_LIST = 'CoreContactList'
    COMBO_BOX = 'ComboBox'
    DATE_TIME = 'DateTime'
    TIME = 'Time'
    LOCATION = 'Location'
    CORE_LOCATION = 'CoreLocation'
    LABEL = 'Label'
    EVENT_LOG = 'EventLog'
    ADDRESS = 'Address'
    CATALOG = 'Catalog'
    CORE_TEAM_LIST = 'CoreTeamList'
    SEGMENT = 'Segment'
    CORE_TIME_SERIES = 'CoreTimeSeries'
    TIME_SERIES = 'TimeSeries'
    COMMAND = 'Command'
    AUTO_NUMBER_NUMERIC = 'AutoNumberNumeric'
    CATALOG_LIST = 'CatalogList'
    CATALOG_COMBO_BOX = 'CatalogComboBox'
    DATE_RANGE = 'DateRange'
    DOCUMENT_GRID = 'DocumentGrid'
    REPORT_LINK = 'ReportLink'
    HYPERLINK = 'Hyperlink'
    PERCENT_COMPLETE = 'PercentComplete'
    CHART = 'Chart'
    RANGE = 'Range'
    EXTERNAL_ID = 'ExternalId'
    ASSET_CATALOG = 'AssetCatalog'
    INVENTORY = 'Inventory'
    CORE_TASK_LABOR_ITEM_TYPES = 'CoreTaskLaborItemTypes'
    CORE_TASK_LABOR_ITEMS = 'CoreTaskLaborItems'
    OBJECT_LIST = 'ObjectList'
    CORE_TIME_ZONE = 'CoreTimeZone'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomField:
    key: Optional[str] = None
    label: Optional[str] = None
    is_active: bool = False
    is_read_only: bool = False
    is_hidden: bool = False
    is_mandatory: bool = False
    display_on_map: bool = False
    custom_field_data_type: Optional[CustomFieldDataType] = None
    values: Optional[str] = None
    prompt: Optional[str] = None
    default: Optional[str] = None
    default_auto_update: bool = False
    required_if: Optional[str] = None
    hidden: Optional[List[str]] = None
    read_only: Optional[List[str]] = None
    control_args: Optional[Dict[str, Object]] = None
    index_slot: Optional[str] = None
    index: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InventoryItemTemplate:
    object_id: Optional[str] = None
    workspace: Optional[str] = None
    name: Optional[str] = None
    custom_fields: Optional[List[CustomField]] = None

Python InventoryItemTemplate 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.

POST /{Workspace}/InventoryItemTemplate HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<InventoryItemTemplate xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.Inventory">
  <CustomFields xmlns:d2p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.Workspaces">
    <d2p1:CustomField>
      <d2p1:ControlArgs xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringanyType>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value />
        </d4p1:KeyValueOfstringanyType>
      </d2p1:ControlArgs>
      <d2p1:CustomFieldDataType>Text</d2p1:CustomFieldDataType>
      <d2p1:Default>String</d2p1:Default>
      <d2p1:DefaultAutoUpdate>false</d2p1:DefaultAutoUpdate>
      <d2p1:DisplayOnMap>false</d2p1:DisplayOnMap>
      <d2p1:Hidden xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:Hidden>
      <d2p1:Index>String</d2p1:Index>
      <d2p1:IndexSlot>String</d2p1:IndexSlot>
      <d2p1:IsActive>false</d2p1:IsActive>
      <d2p1:IsHidden>false</d2p1:IsHidden>
      <d2p1:IsMandatory>false</d2p1:IsMandatory>
      <d2p1:IsReadOnly>false</d2p1:IsReadOnly>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Label>String</d2p1:Label>
      <d2p1:Prompt>String</d2p1:Prompt>
      <d2p1:ReadOnly xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:ReadOnly>
      <d2p1:RequiredIf>String</d2p1:RequiredIf>
      <d2p1:Values>String</d2p1:Values>
    </d2p1:CustomField>
  </CustomFields>
  <Name>String</Name>
  <ObjectId>String</ObjectId>
  <Workspace>String</Workspace>
</InventoryItemTemplate>