Difference between revisions of "REST API/Payload Examples"
imported>Aeric |
imported>Aeric |
||
Line 345: | Line 345: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Field Notes === | ==== Field Notes ==== | ||
:{| border="1" cellpadding="5" cellspacing="1" | :{| border="1" cellpadding="5" cellspacing="1" | ||
! Field !! Possible Values !! Notes | ! Field !! Possible Values !! Notes |
Revision as of 22:30, 30 April 2012
Payload examples for the use case: Add Fields of the specified Field Display Types to an Object.
Learn more: REST API field Resource
In all examples, Method is POST.
Auto Number Field
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink Auto Number</title> <type>AUTO</type> <tableColumn>winkAutoNumber</tableColumn> <universalProperty>true</universalProperty> <description>Added though wink</description> <startingNumber>0001</startingNumber> <autoNumberFormat>YYYY-MM-DD-{0000}</autoNumberFormat> </field>
</platform> </syntaxhighlight>
CheckBox Field
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>checkbox</title> <type>BOOLEAN</type> <tableColumn>checkbox</tableColumn> <defaultValue>true</defaultValue> <universalProperty>false</universalProperty> <description>Added through REST</description> </field>
</platform> </syntaxhighlight>
Currency Field
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>wink currency</title> <type>CURRENCY</type> <tableColumn>wink_currency</tableColumn> <universalProperty>false</universalProperty> <maxFractionalDigits>2</maxFractionalDigits> <displayLength>30</displayLength> <description>Added through wink</description> </field>
</platform>"; </syntaxhighlight>
Date Field
- <syntaxhighlight lang="xml" enclose="div">
String postXml = "<platform>
<field> <title>Wink date field</title> <type>DATE</type> <tableColumn>wink_date_field</tableColumn> <universalProperty>false</universalProperty> <description/> </field>
</platform> </syntaxhighlight>
An additional <display> property can also be specified for custom fields in Custom Objects, with the values:
- as_entered - Store and display the value as entered.
- convert - Convert the value between time zones.
For example:
- <syntaxhighlight lang="xml" enclose="div">
String postXml = "<platform>
<field> ... <display>as_entered</display> </field>
</platform> </syntaxhighlight>
- Learn more: Date/Time Display Types
DateTime Field
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>wink date time</title> <type>DATETIME</type> <tableColumn>wink_date_time</tableColumn> <universalProperty>false</universalProperty> <description>Added through wink</description> </field>
</platform> </syntaxhighlight>
An additional <display> property can also be specified for custom fields in Custom Objects, with the values:
- as_entered - Store and display the value as entered.
- convert - Convert the value between time zones.
For example:
- <syntaxhighlight lang="xml" enclose="div">
String postXml = "<platform>
<field> ... <display>as_entered</display> </field>
</platform> </syntaxhighlight>
- Learn more: Date/Time Display Types
Dependent Picklist Field
- <syntaxhighlight lang="xml" enclose="div">
<platform> "<field>
<title>Wink dependent picklist</title> <type>DEPENDENT_PICK_LIST</type> <universalProperty>false</universalProperty> <tableColumn>wink_dependent_picklist</tableColumn> <enumerationDetails> <showFirstValueAsDefault>false</showFirstValueAsDefault> <sortFlag>false</sortFlag> <enumerationItems> <picklistValue>1</picklistValue> </enumerationItems> <enumerationItems> <picklistValue>2</picklistValue> </enumerationItems> <enumerationItems> <picklistValue>3</picklistValue> </enumerationItems> <enumerationItems> <picklistValue>4</picklistValue> </enumerationItems> <enumerationItems> <picklistValue>5</picklistValue> </enumerationItems> </enumerationDetails> <parentPicklistId>70ab83f90c7c49f4</parentPicklistId> <description>Added through wink</description> </field>
</platform> </syntaxhighlight>
Email Address
- <syntaxhighlight lang="xml" enclose="div">
<platform> <field>
<title>Wink Email Address</title> <type>LEAD_EMAIL</type> <isStandard>false</isStandard> <tableColumn>wink_email_address</tableColumn> <universalProperty>true</universalProperty> <displayLength>200</displayLength> <description>Email address</description> <maxStorageLength>200</maxStorageLength> <customFieldVisibility> <roleId>1</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>2</roleId> <attribute>HIDDEN</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>3</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>1714555710</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <extendedFieldMetaData>Extended data</extendedFieldMetaData> </field>
</platform> </syntaxhighlight>
Email Field
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink Email Address</title> <type>LEAD_EMAIL</type> <tableColumn>wink_email_address</tableColumn> <universalProperty>true</universalProperty> <maxStorageLength>50</maxStorageLength> <displayLength>30</displayLength> <description>Added through wink</description> </field>
</platform> </syntaxhighlight>
File Field
- <syntaxhighlight lang="xml" enclose="div">
String posetXml = "<platform>
<field> <title>Wink file field</title> <type>FILE_FIELD</type> <tableColumn>wink_file_field</tableColumn> <description>Added through wink</description> </field>
</platform> </syntaxhighlight>
Formula Field (date)
Returns a date and no destination field.
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink formula 2</title> <type>FORMULA</type> <tableColumn>wink_formula_2</tableColumn> <numberPrecision>0</numberPrecision> <universalProperty>false</universalProperty> <formula>DATE(2010, 12, 1)</formula> <formulaReturnType>DATE</formulaReturnType> <description>Added through Wink</description> <formulaDestinationField/> </field>
</platform> </syntaxhighlight>
An additional <display> property can also be specified for custom fields in Custom Objects, with the values:
- as_entered - Store and display the value as entered.
- convert - Convert the value between time zones.
For example:
- <syntaxhighlight lang="xml" enclose="div">
String postXml = "<platform>
<field> ... <display>as_entered</display> </field>
</platform> </syntaxhighlight>
- Learn more: Date/Time Display Types
Formula Field (number)
Returns a number and a Destination
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink formula 1</title> <type>FORMULA</type> <tableColumn>wink_formula_1</tableColumn> <numberPrecision>2</numberPrecision> <formula>wink_currency + wink_currency</formula> <formulaReturnType>NUMBER</formulaReturnType> <description>Added through wink</description> <formulaDestinationField>wink_currency</formulaDestinationField> <formula>wink_currency + wink_currency</formula> </field>
</platform> </syntaxhighlight>
Global Picklist Field
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink Global pick</title> <type>GLOBAL_PICK_LIST</type> <tableColumn>wink_global_pick</tableColumn> <universalProperty>false</universalProperty> <enumerationDetails> <showFirstValueAsDefault>true</showFirstValueAsDefault> <sortFlag>false</sortFlag> </enumerationDetails> <globalPicklistId>dabda8ae68a74718a01286a676d3efdc</globalPicklistId> <description>Added through wink</description> </field>
</platform> </syntaxhighlight>
Image File Field
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink image field</title> <type>IMAGE_FIELD</type> <tableColumn>wink_image_field</tableColumn> <universalProperty>false</universalProperty> <description>Added through rest</description> </field>
</platform> </syntaxhighlight>
Lookup Field
Lookup to a System Object
Add a Lookup to a System Object, with some preset filters:
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink lookup 1</title> <type>LOOKUP</type> <tableColumn>wink_lookup_1</tableColumn> <universalProperty>false</universalProperty> <lookUpObjectId>f5ed02cfbfdd4a4aaf2f2a3673f29741</lookUpObjectId> <lookupDisplayType>POPUP</lookupDisplayType> <sortBy>date_created</sortBy> <sortOrder>asc</sortOrder> <lookupPresetFilter> <criteria_1_join_operator/> <criteria_1_pre_bracket>(</criteria_1_pre_bracket> <criteria_1_post_bracket>)</criteria_1_post_bracket> <criteria_1_column>auto_number</criteria_1_column> <criteria_1_operator>equals</criteria_1_operator> <criteria_1_value>11111</criteria_1_value> <criteria_2_join_operator>and</criteria_2_join_operator> <criteria_2_pre_bracket/> <criteria_2_post_bracket>)</criteria_2_post_bracket> <criteria_2_column>wink_currency</criteria_2_column> <criteria_2_operator>equals</criteria_2_operator> <criteria_2_value>1</criteria_2_value> <criteria_3_join_operator>and</criteria_3_join_operator> <criteria_3_pre_bracket/> <criteria_3_post_bracket/> <criteria_3_column/> <criteria_3_operator>equals</criteria_3_operator> <criteria_3_value/> <criteria_4_join_operator>and</criteria_4_join_operator> <criteria_4_pre_bracket/> <criteria_4_post_bracket/> <criteria_4_column/> <criteria_4_operator>equals</criteria_4_operator> <criteria_4_value/> <criteria_5_join_operator>and</criteria_5_join_operator> <criteria_5_pre_bracket/> <criteria_5_post_bracket/> <criteria_5_column/> <criteria_5_operator>equals</criteria_5_operator> <criteria_5_value/> </lookupPresetFilter> <recordSelectionType>STANDARD_LOOKUP</recordSelectionType> <lookupDependentFieldList> <fieldId>63a2f09f16a14af999b81858363b34ba</fieldId> <baseFieldId>ebc004fdebb64a8888fc07d5a824c63d</baseFieldId> </lookupDependentFieldList> <lookupDependentFieldList> <fieldId>df02eaaab877428093dda87d8d29022d</fieldId> <baseFieldId>98e0b1ae0b8143b28cb1356c364e6ad1</baseFieldId> </lookupDependentFieldList> <postSelectionJS>alert(\"this works\");</postSelectionJS> <lookupFields> ,98e0b1ae0b8143b28cb1356c364e6ad1,ebc004fdebb64a8888fc07d5a824c63d </lookupFields> <description>Added through wink</description> </field>
</platform> </syntaxhighlight>
Lookup to a Custom Object
Add a Lookup to a Custom Object:
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Lookup Custom page</title> <type>LOOKUP</type> <tableColumn>wink_lookup_custom_page</tableColumn> <universalProperty>true</universalProperty> <lookUpObjectId>f0772f53f82d41879a50c5392de83c3f</lookUpObjectId> <customPageId>e379c6e9dd694441b3f525fc7e0c0beb</customPageId> <recordSelectionType>CUSTOM_PAGE</recordSelectionType> <lookupFields/> <description>Added through Wink<description/> <isMasterDetailRelationship>false</isMasterDetailRelationship> <lookupDisplayType>DROP_DOWN</lookupDisplayType> <sortBy>date_created</sortBy> <sortOrder>desc</sortOrder> <extendedFieldMetaData>Testing</extendedFieldMetaData> <lookupAutoCopyFields> <lookupAutoCopyField> <srcFieldColumn> // Source field Info <tableColumn>a_currency</tableColumn> </srcFieldColumn> <destFieldColumn> // Destination field info <tableColumn>b_fmcurrency</tableColumn> </destFieldColumn> </lookupAutoCopyField> <lookupAutoCopyField> ... </lookupAutoCopyField> ... <lookupAutoCopyFields> </field>
</platform> </syntaxhighlight>
Field Notes
Field Possible Values Notes lookupDisplayType - POPUP
- DROP_DOWN
sortBy Internal field name, as returned by the REST API:field Resource resource These tags are only used for Standard Lookups shown a Drop Down display.
sortOrder - asc
- desc
tableColumn Internal field name, as returned by the REST API:field Resource resource
Multi Checkbox
- <syntaxhighlight lang="xml" enclose="div">
<platform> <field>
<title>Wink Multi Check Box</title> <type>MULTI_CHECK_BOX</type> <tableColumn>wink_multi_check_box</tableColumn> <universalProperty>false</universalProperty> <enumerationDetails> <showFirstValueAsDefault>true</showFirstValueAsDefault> <sortFlag>true</sortFlag> <enumerationItems> <picklistLabel>label1</picklistLabel> <picklistValue>value1</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> <enumerationItems> <picklistLabel>label2</picklistLabel> <picklistValue>value2</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> <enumerationItems> <picklistLabel>label3</picklistLabel> <picklistValue>value3</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> <enumerationItems> <picklistLabel>label4</picklistLabel> <picklistValue>value4</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> <enumerationItems> <picklistLabel>label5</picklistLabel> <picklistValue>value5</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> </enumerationDetails> <orientation>HORIZONTAL</orientation> <description>Multi Check Box</description> <customFieldVisibility> <roleId>1</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>2</roleId> <attribute>HIDDEN</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>3</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>1714555710</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <extendedFieldMetaData>Extended Meta data</extendedFieldMetaData>
</field> </platform> </syntaxhighlight>
Multi Object Lookup
An example that has Post Selection JavaScript for the Multi Object Lookup field.
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink lookup 1</title> <type>MULTI_OBJECT_LOOKUP</type> <tableColumn>molf1</tableColumn> <universalProperty>false</universalProperty> <multiObjectLookUpDetails> <lookUpObjectId>ACCOUNT</lookUpObjectId> <lookUpObjectId>CONTACT</lookUpObjectId> </multiObjectLookUpDetails> <recordSelectionType>STANDARD_LOOKUP</recordSelectionType> <postSelectionJS>alert(\"this works\");</postSelectionJS> <description>Added through wink</description> </field>
</platform> </syntaxhighlight>
An example that uses a custom JSP for the lookup:
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink lookup 1</title> <type>MULTI_OBJECT_LOOKUP</type> <tableColumn>molf1</tableColumn> <universalProperty>false</universalProperty> <multiObjectLookUpDetails> <lookUpObjectId>ACCOUNT</lookUpObjectId> <lookUpObjectId>CONTACT</lookUpObjectId> </multiObjectLookUpDetails> <recordSelectionType>CUSTOM_PAGE_STR</recordSelectionType> <customPageId>e379c6e9dd694441b3f525fc7e0c0beb</customPageId> <description>Added through wink</description> </field>
</platform>
</syntaxhighlight>
Number
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink number field</title> <type>NUMBER</type> <tableColumn>wink_number</tableColumn> <description>Added through wink</description> <isSignField>false</isSignField> <minNumericValue>0</minNumericValue> <maxNumericValue>0</maxNumericValue> </field>
</platform> </syntaxhighlight>
Number with Decimals
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink number field</title> <type>DOUBLE</type> <tableColumn>test_field_decimal</tableColumn> <description>A double-precision float value.</description> <isSignField>false</isSignField> <maxFractionalDigits>2</maxFractionalDigits> <displayLength>30</displayLength> </field>
</platform> </syntaxhighlight>
Picklist
- <syntaxhighlight lang="xml" enclose="div">
<platform> <field>
<title>Wink Picklist</title> <type>PICK_LIST</type> <tableColumn>wink_picklist</tableColumn> <universalProperty>false</universalProperty> <enumerationDetails> <showFirstValueAsDefault>true</showFirstValueAsDefault> <sortFlag>true</sortFlag> <enumerationItems> <picklistLabel>label1</picklistLabel> <picklistValue>value1</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> <enumerationItems> <picklistLabel>label2</picklistLabel> <picklistValue>value2</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> </enumerationDetails> <customFieldVisibility> <roleId>1</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>2</roleId> <attribute>HIDDEN</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>3</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>1714555710</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <description>Pick List</description> <extendedFieldMetaData>Extended Meta data</extendedFieldMetaData> </field>
</platform> </syntaxhighlight>
Radio Button
- <syntaxhighlight lang="xml" enclose="div">
<platform> <field>
<title>Wink Radio Button</title> <type>RADIO_BUTTON</type> <tableColumn>wink_radio_button</tableColumn> <universalProperty>true</universalProperty> <enumerationDetails> <showFirstValueAsDefault>true</showFirstValueAsDefault> <sortFlag>true</sortFlag> <description>Radio Buttons</description> <enumerationItems> <picklistLabel>1</picklistLabel> <picklistValue>value1</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> <enumerationItems> <picklistLabel>2</picklistLabel> <picklistValue>value2</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> <enumerationItems> <picklistLabel>3</picklistLabel> <picklistValue>value3</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> <enumerationItems> <picklistLabel>4</picklistLabel> <picklistValue>value4</picklistValue> <textColor>#000000</textColor> <textBgColor>#FFFFFF</textBgColor> </enumerationItems> </enumerationDetails> <orientation>VERTICAL</orientation> <customFieldVisibility> <roleId>1</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>2</roleId> <attribute>HIDDEN</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>3</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>1714555710</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <description>Adding radio buttons</description> <extendedFieldMetaData>extended data</extendedFieldMetaData>
</field>
</platform> </syntaxhighlight>
Rich Text Area
- <syntaxhighlight lang="xml" enclose="div">
<platform> <field>
<title>Wink Rich Text Area</title> <type>RICHTEXT_AREA</type> <tableColumn>wink_rich_text_area</tableColumn> <universalProperty>true</universalProperty> <description>Adding Rich Text Area</description> <width>600</width> <customFieldVisibility> <roleId>1</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>2</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>3</roleId> <attribute>HIDDEN</attribute> </customFieldVisibility> <extendedFieldMetaData>Rich Text Area</extendedFieldMetaData> </field>
</platform> </syntaxhighlight>
Text Area
- <syntaxhighlight lang="xml" enclose="div">
<platform> <field>
<title>Wink Text Area</title> <type>TEXT_AREA</type> <tableColumn>wink_text_area</tableColumn> <universalProperty>true</universalProperty> <description>Adding Text Area</description> <width>100</width> <height>100</height> <customFieldVisibility> <roleId>1</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>2</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibility> <customFieldVisibility> <roleId>3</roleId> <attribute>HIDDEN</attribute> </customFieldVisibility> <extendedFieldMetaData>Text Area</extendedFieldMetaData>
</field> </platform> </syntaxhighlight>
Text Field
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<field> <title>Wink Text Field</title> <type>TEXT_FIELD</type> <tableColumn>winkTextField</tableColumn> <universalProperty>false</universalProperty> <displayLength>30</displayLength> <description>first test through rest</description> <maxStorageLength>50</maxStorageLength> <customFieldVisibilityList> <roleId>1215761260</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibilityList> <customFieldVisibilityList> <roleId>1</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibilityList> <customFieldVisibilityList> <roleId>2</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibilityList> <customFieldVisibilityList> <roleId>3</roleId> <attribute>READ_ONLY</attribute> </customFieldVisibilityList> </field>
</platform> </syntaxhighlight>