Previous Page Arrow Next Page Arrow

2.6 Template Resource URL

For every resource kind, there is a special URL that returns a “template resource”. For example, the following URL returns a template account resource:

http://www.exammple.com/sdata/myApp/myContract/-/accounts/$template
Example Component Name Description / Comments
$template Template keyword Special syntax to refer to a resource template
This URL returns the template as an Atom entry.

The template resource allows a service consumer to obtain the resource’s default property values. For example, the URL in the example could be used to fill the contents of a “Create Account” form.

The $template segment is valid after the resource kind segment (accounts in the example).

SData also allows the $template segment after a service operation segment or a named query segment. See Operation Template and Named Query Template sections for details.

Template resources are usually read only, but some applications could expose them in read/write mode, typically to admin accounts.

SData providers MUST support the $template URL on all resources kinds that support the create operation (that have the sme:canPost attribute set to true - see Resource Kind Definition). SData providers MAY support $template URLs on service operations or named queries. If so, they MUST advertise it with an sme:hasTemplate attribute in the schema. See Operation Template and Named Query Template sections for details.

Previous Page Arrow Next Page Arrow