Article
YURI MARX GOMES · Jun 2, 2020 3m read

OData and InterSystems IRIS

What is the OData

OData (Open Data Protocol) is an ISO/IEC approved, OASIS standard that defines a set of best practices for building and consuming RESTful APIs. OData helps you focus on your business logic while building RESTful APIs without having to worry about the various approaches to define request and response headers, status codes, HTTP methods, URL conventions, media types, payload formats, query options, etc. OData also provides guidance for tracking changes, defining functions/actions for reusable procedures, and sending asynchronous/batch requests (source: OData.org).

The OData use cases

  • Deploy data as REST Services with an interoperable format without development effort;
  • Allows BI, data visualization, ERP, CRM, ESB, Workflow tools and engines consume data using REST without development effort;
  • Virtualize corporate data in API Management tools;
  • OData advocates a standard way of implementing REST APIs that allows for SQL-like querying capabilities using these RESTful APIs. OData is essentially SQL for the web built n top of standard protocols – HTTP, JSON & ATOM – while leveraging the REST architecture style (progress.com);
  • OData has a broad adoption, see:

  • OData helps to implement FHIR: FHIR, or Fast Healthcare Interoperability Resources Specification, is a standard for exchanging healthcare information electronically. In order to make FHIR truly interoperable, it is recommended that systems use the rules specified by OData specification for the $search parameter. Further, FHIR also uses OAuth in order to establish a trusted relationship with the client for an extra layer of security (progress.com);
  • OData supports pagination, batch requests and different formats like JSON, ATOM, XML, etc.

OData and InterSystems IRIS

The InterSystems IRIS does not support OData but is possible use the OData Server for InterSystems IRIS to allows expose Persistent classes as REST.

Follow these instructions:

  1. Clone the source code of the IRIS OData Server: git clone https://github.com/yurimarx/isc-iris-odata.git
  2. Go to: isc-iris-odata folder
  3. Execute: mvnw install (MS Windows) or ./mvnw install (linux or mac)
  4. Execute: docker build -t odata:1.0.0 .
  5. Execute: docker run -p 8080:8080 odata:1.0.0. Your OData Server started:

  1. Start your InterSystems IRIS instance with any persistent class, in my ca
  2. In your browser access:   http://localhost:8080/. Set parameters on the screen:

  1. This is parameters to my instance. Set the parameters to your IRIS instance. In namespace set your iris namespace, in the schema, the SQL Table schema, and in the port, the port to your JDBC database connection.
  2. Press submit and RELOAD YOUR ODATA SERVER DOCKER INSTANCE TO APPLY PARAMETERS.
  3. Access http://localhost:8080/odata.svc/ to see all persistent classes to your IRIS schema. In my case is:

  1. To navigate to a persistent class browse: http://localhost:8080/odata.svc/<Persistent_Class> e.g.: http://localhost:8080/odata.svc/Animal
  2. The OData server list Animal data, see:

  1. To see in JSON format browse: http://localhost:8080/odata.svc/Animal?$format=application/json. See:

  1.  To see details about a row browse: http://localhost:8080/odata.svc/Animal(8)?$format=application/json
  2. To delete send a DELETE in your postman with http://localhost:8080/odata.svc/Animal(8)
  3. To insert send a POST in your postman with http://localhost:8080/odata.svc/Animal and a JSON body with property name and value pairs, like:

  1. So you can do all CRUD operations with your persistent classes.
  2. Many other features will be released in the future, if IRIS OData Server get the community adoption.

Thanks!

 

50
1 3 1 226

Replies

Fantastic application, Yuri!

For those who is on Mac you also need to change mvnw to executable:

chmod +x mvnw