API Format in Actions Project
This blog focusses on the concept and usability of API Formats within an Action of the Actions Project.
Concept and Need
Actions Project allows the citizen developer to add a format type to the parameters of the input/output tables. The format can be chosen from the API Format column of these tables. These API formats help to understand the specific data-type format for the parameter that is to be passed to invoke the API.
API Formats are introduced to bridge the gap between the date/time formats that the Action Designer expects and the formats that are internally accepted by the API.
- Click on the API Format selection box of the specific Action Parameter for which a format needs to be specified as shown in figure 1.
- Choose the appropriate format from the API Format selection box. This change will be reflected as shown in figure 2.
- Add a value based on the format selected as shown in figure 3.
Behavior for Input and Output API Format
When an API format is selected for input parameters, the Action Service will expect a consumer value, and the service will convert them to the specified format types to make the API call.
When an API format is selected for output parameters, the Action Service will convert the response from the selected format type and return the result to the citizen developer in the form of a consumer value.
These behaviors are illustrated in figure 4.
Supported API Format types
As of now, Actions Project supports the following API formats:
|Format Type||Definition||Example value||Consumer value|
|None||No format type is specified. Actions will accept any value for the parameter.||Any value||–|
|DD-MM-YYYY||A date format is specified.||
|MM-DD-YYYY||A date format is specified.||01-01-9999||“9999-01-01”|
|YYYY-MM-DD||A date format is specified.||9999-01-01||“9999-01-01”|
|HH:MM:SS||A time format is specified.||12:34:56||“12:34:56Z”, “12:34:56+03:00”|
|EDM DateTime||A timestamp format is specified.||
|EDM Time||A time format is specified.||PT13H20M55S||“12:34:56Z”, “12:34:56+03:00”|
|EDM DateTimeOffset||A time format is specified.||9999-01-01T12:34:56Z||9999-01-01T12:34:56+05|
|Timestamp since Epoch||A timestamp format is specified.||/Date(1492098664000)/||2016-07-08T12:34:56+05|
|Date since Epoch||A date format is specified.||/Date(1492098664000)/||“9999-01-01”|
Disabled or Empty API Format
The Action Designer will sometimes encounter a disabled format selection box or would not see the format selection box at all. This is because API formats are not supported for some parameter types.
The following table details the relationship between the parameter type and API format:
|Parameter Type||API Format|
|string||Supported. Format selection box is shown and usable.|
|integer||Not supported. Format selection box is shown but disabled.|
|boolean||Not supported. Format selection box is shown but disabled.|
|number||Not supported. Format selection box is shown but disabled.|
|array||Not supported. Format selection box is not shown.|
|object||Not supported. Format selection box is not shown.|
- Part 1 of the Blog Series: Actions Project – Major Changes including the Actions Editor Available Now !!
- Part 2 of the Blog Series/Parent Blog: Actions Editor – Feature List, Usage and Maintenance of Actions Project
Thanks for reading and I hope it helped to understand the concept of API Formats in Actions Project. Please feel free to leave a comment if there are any questions and I would be happy to receive any feedback.