API
The API tab allows you to configure the List Methods and, primary keys, as well as to refresh the SmartObject Services available when using the SmartObject OData API.
Configure the list method for the OData feed. This method presents the data. Use default list method is selected by default. To change the list method used in the OData feed, select the Choose list method to use option and select the list method from the drop down. After changing the list method option, you must refresh the service by clicking Refresh Now.
Changing the default list used in the SmartObject Services changes the data presented in an OData feed of the SmartObject. If you have created custom reports using a different list method, those reports may fail the next time you run them.
Which List Method is Used?
The SmartObject OData API publishes SmartObject data using the list method you've configured. The following logic describes how K2 chooses the default list method:
SmartObject List Method Option | Outcome |
You select a SmartObject list method | The SmartObject OData API uses the selected method. |
The SmartObject list method you select does not exist in the SmartObject | The SmartObject OData API uses the first list method associated with the SmartObject. |
A SmartObject does not contain a list method. | The SmartObject OData API does not publish the SmartObject. |
Use the first field returned as the primary key: The OData feed uses the first property defined in the SmartObject as the primary key. To find out what the first property is, open the SmartObject in K2 Designer and see what is at the top of the list.
Choose field to use as the primary key: The drop down is enabled and the SmartObject's properties are listed. The list includes only properties that are Number, Decimal, Text, and GUID (including Autonumber and AutoGuid). This option is useful when you don't want to edit the SmartObject definition to reorder the properties.
After changing the primary key option, you must refresh the service by clicking Refresh Now.
Ensure that the Primary Key value used in the SmartObject OData API is a unique key field type in the SmartObject or contains unique key values. If duplicate or NULL values are used as primary keys, you may get errors.