Open Data Protocol (OData) is a web protocol for querying and updating data, applying and building on web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, and services. Since OData services are easily utilized on different platforms, you can use this service to build cross-platform web and mobile applications.
Note
You cannot use this service to execute dynamic queries.
OData is a new service available in MI 14.0 to run query templates. The function of this service is to execute the query templates in SAP MII. As per REST guidelines, the following requests are allowed to make calls to OData service:
GET: Execute those modes only to retrieve data
POST: Execute all modes
PUT: Executes those modes which insert some data
DELETE: Execute those modes which deletes some data
You can get the metadata document of OData service using the URL, http://<server>:<port>/XMII/IlluminatorOData/$metadata.
You can call an OData service using the URL, http://<server>:<port>/XMII/IlluminatorOData/QueryTemplate where IlluminatorOData is the name of the service and Query Template is the namespace or entity set name. You can also use HTTP action block available in MII Workbench to call an OData service. Different query templates support different http request types in particular modes. The following table displays the modes and request types of query templates.
Query Template |
Mode |
Request Types |
---|---|---|
Tag Query |
All |
GET/POST |
Aggregate Query |
All Modes |
GET/POST |
MDO Query |
Update |
PUT |
Delete |
DELETE |
|
Insert |
POST |
|
All the other modes |
GET/POST |
|
KPI Query |
Delete |
DELETE |
Insert |
POST |
|
All the other modes |
GET/POST |
|
All the modes |
GET/POST |
|
Xcute Query |
All the modes |
GET/POST |
Xcute Query |
All the modes |
GET/POST |
ETC Query |
All the modes |
GET/POST |
Alarm Query |
DBFixedQuery |
POST |
PCo Query |
DBCommandQuery |
POST |
TagStoreQuery |
POST |
|
All the other modes |
GET/POST |
|
Query |
POST |
|
OLAP Query |
All the other modes |
GET/POST |
FixedQuery |
POST |
|
SQL Query |
FixedQueryWithOutput |
POST |
All the other modes |
GET/POST |
|
You can execute query templates in MII using http://<server>:<port>/XMII/IlluminatorOData/QueryTemplate?QueryTemplate=<template name>..
To enter parameters, use http://<server>:<port>/XMII/IlluminatorOData/QueryTemplate?QueryTemplate=<template name>&Mode=<mode>&Server=<server>.. You can pass parameters in the URL to override the existing configured query template parameters.
The default response type is Atom or XML. To receive the data in JSON format, use http://<server>:<port>/XMII/IlluminatorOData/QueryTemplate?Mode=<mode>&$format=json. You have to enter the query template name.
Note
To send requests to the OData service using HTTP POST, PUT or DELETE, you have to send an additional request parameter whose values are fetched in the following way:
The client must send a HTTP GET to the server using the URL, http://<server>:<port>/XMII/IlluminatorOData/QueryTemplate?xsrfid=Fetch.
The server will return one of the header's key as xsrfid and the value will be an encrypted token.
When the services using POST, PUT or DELETE are called, the client returns the token name xsrfid and its value in a request parameter as http://<server>:<port>/XMII/IlluminatorOData/QueryTemplate?QueryTemplate=<template name>&xsrfid=<responseHeaderValue>.
When the client is unable to send the above mentioned token and its value while calling the OData service, then the call is incomplete and an HTTP response code 403 is returned. • The xsrfid token is not required for you to execute the query in HTTP GET.
For more information on Odata, see
http://www.odata.org