Skip to content

Feature request: CREATE PUBLISHED REST SERVICE support in MDL #135

@engalar

Description

@engalar

Feature Request

MDL currently supports DESCRIBE PUBLISHED REST SERVICE (read-only) but not CREATE PUBLISHED REST SERVICE (write). This blocks fully automated REST API creation via CLI.

Use Case

Building a Mock API service for a PoC project. The microflows backing the REST operations are already created via MDL, but the Published REST Service itself must be created manually in Studio Pro.

What I want to write

CREATE PUBLISHED REST SERVICE OrderManagement.MockPSSAPI (
  Path: 'api/pss/v1',
  Version: '1.0.0',
  ServiceName: 'Mock PSS API'
)
{
  RESOURCE 'shipment-notification' {
    Post MICROFLOW OrderManagement.PRS_ShipmentNotification;
  }
  RESOURCE 'orders/{orderNumber}/status' {
    Get MICROFLOW OrderManagement.PRS_GetOrderStatus;
  }
};

What currently happens

Parse error: line 1: no viable alternative at input 'CREATEPUBLISHED'

Context

The existing DESCRIBE output already shows the structure that needs to be round-tripped:

-- From DESCRIBE PUBLISHED REST SERVICE Email_Connector.OAuthHandler:
CREATE PUBLISHED REST SERVICE Email_Connector.OAuthHandler (
  Path: 'mxecoh/',
  Version: '1.0.0',
  ServiceName: 'OAuthHandler'
)
{
  RESOURCE 'callback' {
    Get {customOpPath} MICROFLOW Email_Connector.PRS_AuthCodeCallbackGET;
  }
};

This shows the syntax is already defined for output — it just needs to be supported for input.

Backing Microflow Signatures

The microflows that back Published REST operations follow a specific pattern:

CREATE MICROFLOW Module.PRS_Handler (
  $httpResponse: System.HttpResponse,   -- Required first parameter
  $OrderNumber: String                  -- Path/query parameters
)
RETURNS String AS $ResponseJson         -- Response body
BEGIN
  -- Handler logic
  RETURN $ResponseJson;
END;

Minimum Viable Syntax

At minimum, support:

Element Description
Path URL path prefix (e.g., 'api/pss/v1')
Version API version string
ServiceName Display name
RESOURCE URL path segment with optional {param} placeholders
Get, Post, Put, Delete, Patch HTTP methods mapped to microflows
MICROFLOW Backing microflow reference

Impact

Without this, any project that needs REST APIs must switch to Studio Pro for this single step, breaking the fully-automated CLI workflow. This affects:

  • Mock/stub API creation for PoC projects
  • CI/CD pipelines that generate REST endpoints
  • AI-assisted development (agents can create microflows but not wire them to REST)

Environment

  • mxcli: 0.1.0
  • Mendix: 11.6.4

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions