One of the coolest things with Sitecore are the headless capabilities. Sitecore Services Client (SSC) is one of the available APIs that can be used to read and manipulate data in Sitecore, enabling multiple channels and devices to have access to information managed in Sitecore.
Unfortunately, even though SSC enables reading and writting, it does not provides a way to publish items. Anything created or modified through this API, would either have to be published later, or written directly at the web database. The first takes time and is inconvenient, the second is usually a bad architecture decision.
To cover this gap, Nish Tech has created the SscPublish module. Extending SSC, this module provides a secured API method to publish Sitecore items.
You can browse the source code and download the latest version here:
https://github.com/peplau/SscPublish
Add an entry to ConnectionStrings.config with a SecurityToken to your SSC client:
<name="Sitecore.Services.Token.SecurityKey" connectionString="key=bHN81iFRbluzXGkNNLRqGAlCytp2w9fm"/>
Please, don’t use this secret - instead, create a strong password (Eg: using https://passwordsgenerator.net/)
Follow the pattern:
/sitecore/api/ssc/SscPublish.Controllers/Publish/{itemId}?{parameters}
IMPORTANT: In order to execute a publish, the user authenticated to SSC must be a member of the role sitecore\Sitecore Client Publishing
The implementation will cast the string passed at the mode parameter into the enum Sitecore.Publishing.PublishMode
Accepted values are: