| GET,PUT,POST,DELETE | /{Workspace}/InventoryItemTemplate |
|---|
import Foundation
import ServiceStack
public class InventoryItemTemplate : Codable
{
public var objectId:String
public var workspace:String
public var name:String
public var customFields:[CustomField] = []
required public init(){}
}
public class CustomField : Codable
{
public var key:String
public var label:String
public var isActive:Bool
public var isReadOnly:Bool
public var isHidden:Bool
public var isMandatory:Bool
public var displayOnMap:Bool
public var customFieldDataType:CustomFieldDataType
public var values:String
public var prompt:String
public var `default`:String
public var defaultAutoUpdate:Bool
public var requiredIf:String
public var hidden:[String] = []
public var readOnly:[String] = []
public var controlArgs:[String:Object] = [:]
public var indexSlot:String
public var index:String
required public init(){}
}
public enum CustomFieldDataType : String, Codable
{
case Text
case Number
case Decimal
case Money
case PhoneNumber
case Ssn
case List
case Date
case File
case Barcode
case GPS
case Photo
case Spacer
case Separator
case AutoNumber
case TextArea
case Contact
case User
case Asset
case Checkbox
case CoreAssetList
case CoreTaskList
case CoreParentTask
case CoreContactList
case ComboBox
case DateTime
case Time
case Location
case CoreLocation
case Label
case EventLog
case Address
case Catalog
case CoreTeamList
case Segment
case CoreTimeSeries
case TimeSeries
case Command
case AutoNumberNumeric
case CatalogList
case CatalogComboBox
case DateRange
case DocumentGrid
case ReportLink
case Hyperlink
case PercentComplete
case Chart
case Range
case ExternalId
case AssetCatalog
case Inventory
case CoreTaskLaborItemTypes
case CoreTaskLaborItems
case ObjectList
case CoreTimeZone
}
Swift InventoryItemTemplate DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
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: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ObjectId: String,
Workspace: String,
Name: String,
CustomFields:
[
{
Key: String,
Label: String,
IsActive: False,
IsReadOnly: False,
IsHidden: False,
IsMandatory: False,
DisplayOnMap: False,
CustomFieldDataType: Text,
Values: String,
Prompt: String,
Default: String,
DefaultAutoUpdate: False,
RequiredIf: String,
Hidden:
[
String
],
ReadOnly:
[
String
],
ControlArgs:
{
String: {}
},
IndexSlot: String,
Index: String
}
]
}