2.4 Service Operation URL
SData is based on a REST architecture and an SData service should primarily expose “resources”. There are nevertheless scenarios where it is useful to expose “service operations” in addition to resources. Here is typical SData service URL:
http://www.example.com/sdata/myApp/myContract/-/products/$service/computePrice
Example | Component Name | Description / Comments |
---|---|---|
$service | Service keyword | Special syntax to distinguish service operations from other resources. |
computePrice | Operation Name | This element identifies a service operation. The operation MUST be invoked by posting an Atom entry containing the parameters to this URL. The SData service will return the computed prices as an Atom entry containing the result. See Synchronous Service Operations for details. In this example the input and output are Atom entries, but SData also supports Atom feeds as input and/or output to service operations. See Service Operations section for details. |
The $service component MAY be placed after the dataset segment, if it applies to the entire contract. In that case it would go after test in the example. Or it MAY be placed after the resource kind segment, if it applies to resources of a specific kind as in the example.
SData providers MAY provide service operations. If they do so, they MUST use the above URL syntax to expose their service operations.