Show TOC

Function documentationOData Locate this document in the navigation structure

 

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 Note

You cannot use this service to execute dynamic queries.

End of the note.

Features

OData is a new service available in MII 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 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.

End of the note.

To extract only certain navigation properties from the OData service, see the following table:

Navigation Properties

URL

Example URL

Rowset Entities

<protocol>:<server>:<port>/XMII/IlluminatorOData/Rowset(‘<QueryTemplateName>’)/Rowset

http://myServer:10000/XMII/IlluminatorOData/Rowsets(‘MyProject/MyFolder/MyQuery’)/Rowset

Message Entities

<protocol>:<server>:<port>/XMII/IlluminatorOData/Rowset(‘<QueryTemplateName>’)/Messages

http://myServer:10000/XMII/IlluminatorOData/Rowsets(‘MyProject/MyFolder/MyQuery’)/Message

Column Entities

<protocol>:<server>:<port>/XMII/IlluminatorOData/Rowset(‘QueryTemplate=’<QueryTemplateName>’RowsetId='<rowsetId>')/Column

http://myServer:10000/XMII/IlluminatorOData/Rowset(QueryTemplate=‘MyProject/MyFolder/MyQuery’,RowsetId=1)/Column

where RowsetId is the Id of the rowset for which the column entities are displayed.

Row Entities

<protocol>:<server>:<port>/XMII/IlluminatorOData/Rowset('QueryTemplate=‘<QueryTemplateName>',RowsetId='<rowsetId>')/Row

http://myServer:10000/XMII/IlluminatorOData/Rowset(QueryTemplate=‘MyProject/MyFolder/MyQuery’,RowsetId=1)/Row

where RowsetId is the Id of the rowset for which the row entities are displayed.

Note 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>

End of the note.

More Information

  • For more information on Odata, see   http://help.sap.com   SAP NetWeaver   SAP NetWeaver Gateway   SAP Library   SAP NetWeaver Gateway   SAP NetWeaver Gateway Master Guide   SAP NetWeaver Gateway and OData.  

  • http://www.odata.org