OData
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 and higher versions 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
To setup SAML2.0 authentication scheme for the OData service, go to Authentication
and Single Sign On
under Configuration
in NetWeaver
. Set the policy configuration for the web module, sap.com/xapps~xmii~ear*IlluminatorOData to SAML2LoginModule. Please refer to Configuring AS Java as a Service Provider to setup the login configuration. The Identity Federation should be enabled for the trusted provider and the NW UME user mapping should be done for the logon id. Please refer to Identity Federation to configure user mapping for SAML2.
Caution
You must enable the trusted provider and map NW UME user. For more details, see the help portal at
Note
The URL http://<server>:<port>/XMII/IlluminatorOData/$metadata uses basic authentication scheme. To get metadata for a specific query template and to generate the response with row properties, use http://<server>:<port>/XMII/IlluminatorOData/$metadataQueryTemplate=<Full path to Query Template>.
This scenario is available from MII 15.0 SP02 release onwards.
To access the OData service using SAML2 authentication, use the URL http://<server>:<port>/IlluminatorOData/$metadata. For example, You can execute query templates in MII using http://<server>:<port>/IlluminatorOData/QueryTemplate?QueryTemplate=<template name>.
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 |
SQL Query | FixedQuery | GET |
FixedQueryWithOutput | POST | |
All the other modes | GET/POST | |
Command | 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>
.
While calling the OData service, if the client is unable to send the above mentioned token and its value, the call is incomplete and returns an HTTP response code 403 error. The xsrfid
token is optional and is not required to execute the query in HTTP GET.
To extract only certain navigation properties from the OData service, see the following table:
Navigation Properties | URL | Example URL |
|---|---|---|
Rowset Entities |
| http://myServer:10000/XMII/IlluminatorOData/Rowsets(‘MyProject/MyFolder/MyQuery’)/Rowset |
Message Entities |
| http://myServer:10000/XMII/IlluminatorOData/Rowsets(‘MyProject/MyFolder/MyQuery’)/Message |
Column Entities |
| http://myServer:10000/XMII/IlluminatorOData/Rowset(QueryTemplate=‘MyProject/MyFolder/MyQuery’,RowsetId=1)/Column where |
Row Entities |
| http://myServer:10000/XMII/IlluminatorOData/Rowset(QueryTemplate=‘MyProject/MyFolder/MyQuery’,RowsetId=1)/Row where |
Note
You can also pass all the overriding parameters as follows:
http://myServer:10000/XMII/IlluminatorOData/Rowset(QueryTemplate=‘MyProject/MyFolder/MyQuery’,RowsetId=1)/Row?Param.1=<value>Param.2<value>
For more information on OData, see