How to access unpublished data from rest calls

Once user modified/updated data in content using , we click on save so after saving the data
http://localhost:8080/cms/?1

But when i access http://localhost:8080/site/api/documents
I am not able to see the updated JSON until i did published

Is their any why we can do Achieve this?

Steps i tried so far in my local:

  1. Created Beans using bean writer in essentials.
  2. Created Rest Full service for the Bean
  3. When i use the URl
  4. from here i can modify any thing to achieve?
    below http://localhost:8080/site/api-manual/myexample/

I am getting console logs in my rest controller.
which is created at
myproject/elcapitan/site/components/src/main/java/com/example/rest/HelloMenuResource.java

This seems to be just right, publishing makes content available for live site or REST output.

What exactly are you trying to achieve?

Regards, Jeroen

I am tryin g to achieve folder level rest API access

Example below api calls should return JSON as response.
http://localhost:8080/site/api-manual/Myfolder
http://localhost:8080/site/api-manual/MyFolder/leftnav
http://localhost:8080/site/api-manual/MyFolder/rightnav

You could add a new mount which you call api-preview for example, this mount needs the property hst:type=preview and then you can access all unpublished data over this endpoint. For example when your live content is visible over http://localhost:8080/site/api/documents you can now access your preview content over http://localhost:8080/site/api-preview/documents

Hope this helps!

Best regards,
Jesper

Thanks Jesper it worked Steps What i did.

  1. I verified the http://localhost:8080/site/api/documents and able to see the published content only.

  2. I did went to hst:myprpject=>hst:hosts => dev-localhost => hst:root => copied the node for current api then crated new node with name api-preview and added property hst:type as preview

  3. then I verified the http://localhost:8080/site/api-preview/documents
    i am able to see the unpublished data.:smiley:

1 Like

it works when i access able to see all documents.
http://localhost:8080/site/api-preview/documents
once i click data it is not working it giving empty {}

When i click on http://localhost:8080/site/api-preview/documents/83fd1f43-0567-4cc3-b01b-6adb3cdc1c37
it is empty is their any way to handle child’s

{

}