REST Messaging API

The IBM MQ REST messaging API lets applications put and get messages without compiling against MQI. A microservice can POST JSON to a queue on a queue manager reachable through mqweb, and a serverless function can GET the next message for light processing—provided TLS, authentication, and authority are configured. Beginners confuse messaging URLs with admin URLs and receive 404 or 403 while runmqsc works fine. This tutorial explains messaging versus admin REST, typical URL structure on modern releases, JSON message layout, put and get semantics compared to MQPUT and MQGET, syncpoint considerations, browsing, limits, and when REST messaging is the right integration choice.

Messaging vs Administration REST

Administration REST creates queues, displays channels, pings connections—object lifecycle. Messaging REST carries business payloads—the orders, payments, and events your enterprise routes through MQ. Both may run on the same mqweb port (often 9443) but paths and permissions differ. Grant messaging users +put and +get on specific queues, not +all admin on the queue manager unless they truly operate the estate.

REST messaging vs MQI
AspectREST messagingMQI client
TransportHTTPS JSONTCP MQ protocol
PerformanceModerate overheadHighest throughput
DeploymentAny HTTP stackNeeds MQ client install
TransactionsPer request modelFull UOW/syncpoint

Typical Put Flow

Client obtains token or basic auth credentials permitted on mqweb. TLS connects to https://host:9443/ibmmq/rest/v1/ (exact path per release—verify IBM doc). POST to the messaging endpoint for a named queue manager and queue with JSON containing message body (often base64 for binary), format, persistence, and optional headers. Success returns HTTP 201 or 200 with message identifiers. Failure returns 4xx with JSON error explaining authority or unknown queue—map to 2035 and 2085 familiar reason concepts.

shell
1
2
3
4
5
# Illustrative curl—adjust URL and auth to your mqweb config: curl -k -u admin:password -X POST \ 'https://mqhost:9443/ibmmq/rest/v1/messaging/qmgr/QM1/queue/PAY.IN/message' \ -H 'Content-Type: application/json' \ -d '{"type":"string","message":"payment-12345","persistence":"persistent"}'

Get and Browse

GET retrieves messages from a queue—destructive get removes the message like MQGET; browse endpoints may exist for non-destructive inspection per release. Specify wait interval in query parameters where supported to avoid tight polling loops that load mqweb. Long polling or moving to event-driven patterns (MQIPT, AMQP, or native MQI) may suit high fan-out consumers better than hammering REST GET every second.

Message Descriptor in JSON

REST maps MQMD concepts into JSON fields: format, priority, persistence, reply-to queue, correlation id. Beginners omit persistence and wonder why messages disappear on restart—set persistence explicitly for business-critical data. Character sets and CCSID matter for international text—test Unicode payloads end-to-end.

Security

  • TLS 1.2+ on mqweb; corporate CA in trust stores.
  • Least-privilege MQ credentials per microservice.
  • Do not expose mqweb to public internet without WAF and auth.
  • Audit REST puts like application MQPUT—same compliance scope.

When to Choose REST Messaging

Choose REST when the team only has HTTP tooling, volume is moderate, and latency in tens of milliseconds is acceptable. Avoid REST as the core of mainframe-grade throughput on the same QM without load testing. Hybrid designs use REST at the edge and MQI inside the data center.

Explainer: Mail Slot Through a Web Form

MQI is handing a letter directly to the postal clerk. REST messaging is filling a web form that the clerk transcribes onto a letter—convenient for remote submitters, slower for millions of letters.

Explain Like I'm Five: REST Messaging API

Instead of using the special mail-machine language, you send a note through a website and the website puts the note in the right mailbox.

Practice Exercises

Exercise 1

Lab: one REST put and one GET; verify CURDEPTH and message content in Explorer.

Exercise 2

Compare latency: 1000 REST puts vs MQI puts in test (document hardware).

Exercise 3

List three fields your JSON put must set for persistent payment messages.

Frequently Asked Questions

Frequently Asked Questions

Test Your Knowledge

Test Your Knowledge

1. REST messaging API moves:

  • Business messages
  • Only channel defs
  • Page sets
  • Archive logs

2. Payload format is typically:

  • JSON
  • COBOL copybook only
  • JCL
  • Binary only

3. mqweb serves:

  • REST over HTTPS
  • FTP only
  • SMTP
  • Native only

4. High throughput usually prefers:

  • MQI/JMS client
  • REST only
  • No syncpoint
  • FTP put
Published
Read time19 min
AuthorMainframeMaster
Verified: IBM MQ 9.3 documentation