Magnolia 5.7 reached extended end of life on May 31, 2022. Support for this branch is limited, see End-of-life policy. Please note that to cover the extra maintenance effort, this EEoL period is a paid extension in the life of the branch. Customers who opt for the extended maintenance will need a new license key to run future versions of Magnolia 5.7. If you have any questions or to subscribe to the extended maintenance, please get in touch with your local contact at Magnolia.
This page describes the commands
endpoint, which can be used to trigger commands defined in catalogs.
Commands can perform duties within the system or connect to external resources.
The REST resource must be called with HTTP POST.
You can only call commands via REST which are whitelisted at /modules/rest-services/rest-endpoints/commands/enabledCommands
. (For further details see REST module configuring the commands endpoint and REST security.)
Request URLs
The endpoint recognizes URLs with or without a catalog parameter.
POST /commands/v2/{catalogName}/{commandName}
POST /commands/v2/{commandName}
Parameters
Parameter | Description | Parameter type | Data type |
commandName | required The name of the command as defined in the Command definition. | path | String |
| optional default catalog name is The name of the Command catalog. |
|
|
| required Request body in JSON or XML format; it contains the parameters required to execute the command. |
|
|
Example
Here are a couple of examples for publishing content using the commands endpoint.
Publish page
Publish (activate) the page /travel/hello
.
curl http://localhost:8080/magnoliaAuthor/.rest/commands/v2/website/activate \ -H "Content-Type: application/json" \ -X POST --user superuser:superuser \ --data \ '{ "comment": "Published via REST", "repository": "website", "path": "/travel/hello", "recursive": false }'
You cannot send the request as XML, you only can receive the response in XML with the Accept
header.
Schedule page
Publish (activate) the page /travel/hello
on a future date.
curl http://localhost:8080/magnoliaAuthor/.rest/commands/v2/website/activate \ -H "Content-Type: application/json" \ -X POST --user superuser:superuser \ --data \ '{ "comment": "Published via REST (scheduled)", "publicationDate": "2020-01-01T11:10:00.000+01:00", "repository": "website", "path": "/travel/hello", "recursive": false }'