UPDATE: As of MQ 9.0.4 there is a built in messaging REST API provided by MQ. We will release a detailed blog article on the new API in due course, but if you want to find out more then read this.
Every time I talk to a customer about the new administrative REST API there is the inevitable question: “Can I use it to put and get messages?” Well, the answer is no you can’t. It is an administrative REST API not a programmatic one.
I couldn’t find anything that lists all the options available for programmatic REST APIs that interact with MQ, so I thought I would put this blog article together so I could direct customers to it.
Here are the, IBM provided, options you can choose from if you want to send messages to, and receive messages from, MQ using REST.
- MQ HTTP bridge
- z/OS Connect EE
- DataPower Gateway
MQ HTTP bridge
The bridge is provided free with MQ. It is a JEE application that can be installed into a suitable run time environment and provides a basic REST API on top of both the queues and topics hosted by a single MQ queue manager.
Applications can issue an HTTP POST to the bridge to send a message to MQ, an HTTP GET to browse a message from MQ, or an HTTP DELETE to destructively get a message from MQ. Support is provided for a number of different HTTP headers which can be used to set message properties, etc.
One thing you should be aware of with the MQ HTTP bridge is that it was deprecated in MQ 8. However if you want to get a simple, and free, REST API for interacting with MQ this might be of interest to you.
More information on the bridge is here.
IIB or IBM Integration Bus is IBM’s leading integration technology which can be used to connect applications and systems together regardless of the message formats and protocols that they support.
IIB has always supported MQ and provides HTTPInput and HTTPRequest nodes which can be used to build up a RESTful interface on top of MQ, and many other systems such as databases.
IIB can be used to do much more than provide a simple REST façade on top of MQ, and its capabilities can be used to provide advanced payload manipulation, payload enrichment, and many other things as part of a REST API.
The IIB KnowledgeCentre includes a technology sample which exposes a JSON over REST interface on top of an MQ application that expects an XML payload.
z/OS Connect EE
z/OS Connect EE (zCEE) is a z/OS product that allows you to build REST APIs on top of existing z/OS assets such as CICS or IMS transactions, and MQ queues and topics too. This allows you to REST enable your assets without changing them or any of the existing applications that use them.
With zCEE you can very easily build up a REST API that will send and receive JSON data and optionally transform that data into the more traditional language structures, such as COBOL copybooks, expected by many mainframe applications .
An Eclipse based tool, the API editor, can be used to build up a proper RESTful API, making use of query parameters and URL path segments, and manipulate the JSON format as it flows through the zCEE runtime.
zCEE can be used to expose MQ queues and topics as services. Two different service types are supported:
- One way services: the function provided here is very similar to that provided with the MQ HTTP bridge where an HTTP POST sends a message, an HTTP DELETE destructively gets a message, etc. The main benefits over the bridge is the built in data-conversion support and the fact that you can use the API editor to build up a more RESTful API
- Two way services: these provide a REST API on top of a pair of queues used by a back-end request-response style application. Callers issue an HTTP POST to the two-way service and send in JSON data. This data is put onto a request queue where it is processed by the back-end application and a response placed on the response queue. This is retrieved and sent back to the caller as the POST response body
So, if you are on z/OS, and want to expose your existing assets via REST then this might be a good option for you. zCEE is supported with MQ V8 and later. If you need more advanced data mapping capabilities than those provided with zCEE then you should consider IIB or DataPower.
Information on zCEE is here.
IBM DataPower Gateway is a single multi-channel gateway which helps provide security, control, integration and optimized access to a range of systems, including MQ. It comes in both hardware and virtual form factors.
One of the services that DataPower provides is a multi-protocol gateway which can take input in one protocol and generate output in a different protocol. In particular DataPower can be configured to accept HTTP(S) data and route it to MQ over a client connection, which can be used to build a REST façade on top of MQ. Other DataPower services such as transformation could also be used to enhance the REST façade.
Information on using DataPower with MQ is here.
So, as you can see, there are a number of options if you want a programmatic REST API for MQ. If you want to find out more about the administrative REST API then here are some resources for you: