3

We have a custom dashboard for monitoring all servers health check, as part that we have one component to display publishing statistics (Here we display ongoing, queued publish items). Now we are using publish service to publish data from one database to another database.

We tried using Web API to get response from publishing service ( https://{hosturl}/sitecore/api/ssc/publishing/jobs/%7B00000000-0000-0000-0000-000000000000%7D/All?sourceDatabase=master ) but getting 403 forbidden or unauthorized exception.

Please help us here any other way to get response from above URL.

1 Answer 1

3

Usually anonymous users are not allowed to access Sitecore RESTful API for security reasons. You should send a POST request to /sitecore/api/ssc/auth/login to authenticate a user before calling any other /sitecore/api/ssc/... API method.

By default Sitecore API is configured to use session-based authorization, but if you want to use token authorization then change the setting Sitecore.Services.Token.Authorization.Enabled to true. All settings related to API security and authorization are listed in the file /App_Config/Sitecore/Services.Client/Sitecore.Services.Client.config, though be careful and consider application security before changing any of them.

There is also an alternative way to get publishing queue information. You can call Publishing Service API directly and get the list of queued jobs by calling the API method:

https://{publishing-service-host}/api/publishing/jobqueue

If there is an active publishing job, it will be returned by the method:

https://{publishing-service-host}/api/publishing/activejob

You can call the following API method to the list of recent jobs:

https://{publishing-service-host}/api/publishing/jobhistory?skip=0&top=10
2
  • How to get recent jobs ?
    – Reddy
    Sep 30, 2022 at 6:12
  • @Reddy you can call https://{publishing-service-host}/api/publishing/jobhistory?skip=0&top=10 to get the list of recent jobs, parameters skip and top are used for pagination. I added these details to the answer above too.
    – Anna Gevel
    Sep 30, 2022 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.