The REST writes through the kernel, nxc_powercontent no longer needed (6.0.15, ezprestapi 1.2.9)
Read this page before you update an installation that uses the REST API to create, update or remove content, that
has nxc_powercontent installed, or that writes content from its own PHP code. From Exponential 6.0.15 the kernel
writes content from plain values itself, with expContentWriter, and
ezprestapi 1.2.9 writes through it instead of through nxc_powercontent.
In short
| Before (kernel up to 6.0.14, ezprestapi up to 1.2.8) | Since (kernel 6.0.15, ezprestapi 1.2.9) | |
|---|---|---|
| Who writes REST content | nxc_powercontent (nxcPowerContent), required by ezprestapi | the kernel's expContentWriter; ezprestapi requires no other extension |
| Update over REST | answered 501 (not implemented) | POST or PUT /api/ezp/v2/content/node/<node id> publishes a new version; 200, or 202 when a workflow holds it |
| Request body of a write | form fields | form fields or a JSON object (Content-Type: application/json) |
| File value | a path on the server, or any URL (redirects followed) | a public http(s) address only, no redirects, at most 50 MB; a server path answers 400 |
| Unknown attribute identifier | ignored | 400 invalid_request naming the identifiers |
| Value that is not text | written as whatever it became | 400 invalid_request |
| Create held by a workflow | 201 | 202 with "message":"Waiting for a workflow" |
| Create answer | {"message","objectId","nodeId"} | the same plus version |
| A write that failed | 500 | 500 for an error during the write (rolled back), 400 for input that cannot be written |
| A write on an older kernel | 501 not_implemented (no expContentWriter); reads work as before | |
An address that names no provider, without ezprestapi | fatal error loop, 500 | 404 |
| PHP code that creates content | by hand, eZContentFunctions, or an extension | also expContentWriter::create(), update(), remove() |
Unchanged: the routes, the reads at v1 and v2 and their answers, authentication with OAuth2 tokens and personal API keys, the permission checks of 1.2.5, the delete (it removes every location and what is below them, not to the trash, as before).
What to do when you upgrade
Update the kernel to 6.0.15 first, then
ezprestapi. Withezprestapi1.2.9 on an older kernel the writes answer501; reads keep working.composer update se7enxweb/exponential se7enxweb/ezprestapiThe root
composer.jsonof 6.0.15 requiresse7enxweb/ezprestapi ~1.2.9; a site's owncomposer.jsonwith an older constraint (~1.2.8) needs it raised first.Let Composer remove nxc_powercontent, or keep it on purpose.
ezprestapi1.2.9 no longer requiresse7enxweb/nxc_powercontent. When nothing else requires it, the update above removes it, and with it the folderextension/nxc_powercontent. Find out beforehand:composer why se7enxweb/nxc_powercontent grep -rn "nxc_powercontent\|nxcPowerContent" settings/ extension/*/classes extension/*/modules extension/*/bin 2>/dev/null | grep -v "^extension/nxc_powercontent/"composer whynames onlyse7enxweb/ezprestapi, and thegrepfinds nothing: nothing of yours uses it. Let the update remove it.- Your own
composer.jsonrequires it: it stays. Remove it withcomposer remove se7enxweb/nxc_powercontentwhen you no longer need it. - Your own code calls
nxcPowerContent, or a template usespowercontent_create_gui: keep it (require it in your owncomposer.json) or move the code toexpContentWriter(Moving code to expContentWriter).
nxc_powercontentis not the same extension aspowercontent(se7enxweb/powercontent, the content creation tools for templates). The rootcomposer.jsonstill requirespowercontent; nothing on this page changes it.Take nxc_powercontent out of the settings if it is gone. Remove
ActiveExtensions[]=nxc_powercontent(and anyActiveAccessExtensions[]=nxc_powercontent) fromsettings/override/site.ini.append.phpand the siteaccesses. While it was active, it replaced the kernel'scontentmodule with its own copy (ModuleSettings ExtensionRepositories[]=nxc_powercontent,ModuleList[]=content); without it the kernel's owncontentmodule runs; it has every view that copy had.Regenerate the autoloads, clear the caches and reload PHP. The autoload generator maps classes of every folder below
extension/, active or not, andnxc_powercontentcarries copies of kernel classes in itsmodules/contentfolder. After the folder is gone, regenerate sovar/autoload/ezp_override.phpnames none of them:php bin/php/ezpgenerateautoloads.php -e -o ./console exp:velocity deploy --allow-root-user # INI and template caches, PHP-FPM reload, Velocity restartWithout the deploy command:
php bin/php/ezcache.php --clear-tag=ini --allow-root-user, reload the PHP-FPM that serves the site, and restart Velocity if it runs.Check your REST clients against the table above. What a client may have to change:
- a file value that names a path on the server: give a public
httpsaddress of the file instead; - fields that are not attributes of the class: leave them out. Every form field of a create or update besides
parentNodeID,classIdentifier,languageLocaleand_methodis taken as an attribute value, so a client that posts its token as the form fieldoauth_tokengets400; send the token in theAuthorizationheader; - a create can answer
202when a workflow holds the new object: treat it as accepted, not as an error; - a client that worked around the missing update (remove and create again, or a write through expservices) can now update in place, which keeps the object id, the node id, the URL and the history.
- a file value that names a path on the server: give a public
Give update keys the
editscope. A personal API key needs the scopeeditfor an update (rest.ini [ApiKeySettings] RouteScopes[ezp7xRestContentController_UpdateContentNode]=edit, shipped), and the key's user needscontent/editin the language written.Test a write. With a key or token of a test user:
curl -s -X POST -H "Authorization: Bearer $EXP_API_KEY" -H "Content-Type: application/json" \ -d '{"parentNodeID":2,"classIdentifier":"folder","languageLocale":"eng-US","name":"REST test"}' \ https://www.example.com/api/ezp/v2/content/node/create # {"message":"Created","objectId":<object id>,"nodeId":<node id>,"version":1} curl -s -X PUT -H "Authorization: Bearer $EXP_API_KEY" -H "Content-Type: application/json" \ -d '{"name":"REST test, updated"}' https://www.example.com/api/ezp/v2/content/node/<node id> # {"message":"Updated","objectId":<object id>,"nodeId":<node id>,"version":2,"languageLocale":"eng-US"} curl -s -X DELETE -H "Authorization: Bearer $EXP_API_KEY" \ https://www.example.com/api/ezp/v2/content/node/delete/<node id> # {"message":"Removed","nodeId":<node id>,"objectId":<object id>}A
501means the kernel is older than 6.0.15; a403that the key lacks the scope or its user the policy.
Moving code to expContentWriter
| nxc_powercontent | expContentWriter |
|---|---|
$pc = new nxcPowerContent(); $pc->createObject( array( 'parentNode' => $node, 'class' => $class, 'languageLocale' => 'eng-US', 'attributes' => $values ) ) | expContentWriter::create( array( 'parentNodeID' => $nodeID, 'classIdentifier' => 'article', 'languageLocale' => 'eng-US', 'attributes' => $values ) ) |
returns the object or false | returns status, message, object, version |
$pc->updateObject( array( 'object' => $object, 'attributes' => $values ) ): changes the current version in place | expContentWriter::update( $object, $values, 'eng-US' ): publishes a new version, the old one stays in the history |
$pc->removeObject( $object ) | expContentWriter::remove( $object ) (or remove( $object, true ) for the trash) |
| file values: a server path or any URL | a public http(s) address; for files on the server, eZContentFunctions with storage_dir |
| rich text as HTML | rich text as HTML (the Online Editor's parser; links and embeds become relations) |
parentNode on update moves the object; additionalParentNodeIDs sets more locations; visibility hides | not part of the writer: eZContentObjectTreeNodeOperations::move(), eZContentOperationCollection::addAssignment(), eZContentObjectTreeNode::hideSubTree() |
| debug output on the command line | the answer's message; errors in the debug log, held versions in var/log/contentwriter.log |
The guide has complete examples: Writing content from PHP with expContentWriter.
Code and tests
kernel/classes/contentwriter/expcontentwriter.php(kernel commit "Added: expContentWriter creates, updates and removes content from plain values", 12 November 2026); DB-less tests intests/tests/kernel/classes/contentwriter/expContentWriterTest.php(CW-01 to CW-06).extension/ezprestapi/classes/controllers/content.php(doCreateContentNode,doUpdateContentNode,doDeleteContentNode) andclasses/rest_provider.php(the routeezpNodeUpdate,POSTandPUT), ezprestapi 1.2.9.kernel/private/rest/classes/router.php: an address without a provider reaches the error route when the default providerezpis missing; route matching tests RM-08 and RM-12 intests/tests/kernel/private/restapi/ezpRestRouteMatchingTest.php.
Related pages
- Content from plain values: expContentWriter
- New in 6.0.15: the REST API updates content
- REST API v1 and v2, Personal API keys
- ezprestapi, nxc_powercontent
- Behavior changes of the extensions
- Upgrading
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.