# How to access unpublished data from rest calls

**URL:** <https://community.bloomreach.com/t/how-to-access-unpublished-data-from-rest-calls/1218>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [July 3, 2019, 8:38pm UTC](https://community.bloomreach.com/t/how-to-access-unpublished-data-from-rest-calls/1218 "2019-07-03T20:38:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ponnuru765](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/ponnuru765/32/421_2.png) [@ponnuru765](https://community.bloomreach.com/u/ponnuru765)\
**Post date:** [July 3, 2019, 8:38pm UTC](https://community.bloomreach.com/t/how-to-access-unpublished-data-from-rest-calls/1218/1 "2019-07-03T20:38:30Z")

</div>

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

But when i access [http://localhost:8080/site/api/documents](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/](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

---

<div class="post-metadata">

**Author:** ![jeroen.hoffman](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jeroen.hoffman/32/43_2.png) [@jeroen.hoffman](https://community.bloomreach.com/u/jeroen.hoffman)\
**Post date:** [July 4, 2019, 7:03am UTC](https://community.bloomreach.com/t/how-to-access-unpublished-data-from-rest-calls/1218/2 "2019-07-04T07:03:17Z")

</div>

> [@ponnuru765](#):
>
> But when i access [http://localhost:8080/site/api/documents](http://localhost:8080/site/api/documents)  
> I am not able to see the updated JSON until i did published

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

> [@ponnuru765](#):
>
> Is their any why we can do Achieve this?

What exactly are you trying to achieve?

Regards, Jeroen

---

<div class="post-metadata">

**Author:** ![ponnuru765](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/ponnuru765/32/421_2.png) [@ponnuru765](https://community.bloomreach.com/u/ponnuru765)\
**Post date:** [July 5, 2019, 9:21pm UTC](https://community.bloomreach.com/t/how-to-access-unpublished-data-from-rest-calls/1218/3 "2019-07-05T21:21:58Z")

</div>

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)  
[http://localhost:8080/site/api-manual/MyFolder/leftnav](http://localhost:8080/site/api-manual/MyFolder/leftnav)  
[http://localhost:8080/site/api-manual/MyFolder/rightnav](http://localhost:8080/site/api-manual/MyFolder/rightnav)

---

<div class="post-metadata">

**Author:** ![Jesper\_Volkers](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jesper_volkers/32/146_2.png) [@Jesper\_Volkers](https://community.bloomreach.com/u/Jesper_Volkers)\
**Post date:** [July 8, 2019, 8:31am UTC](https://community.bloomreach.com/t/how-to-access-unpublished-data-from-rest-calls/1218/4 "2019-07-08T08:31:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ponnuru765](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/ponnuru765/32/421_2.png) [@ponnuru765](https://community.bloomreach.com/u/ponnuru765)\
**Post date:** [July 8, 2019, 6:34pm UTC](https://community.bloomreach.com/t/how-to-access-unpublished-data-from-rest-calls/1218/5 "2019-07-08T18:34:51Z")

</div>

Thanks Jesper it worked Steps What i did.

1. I verified the [http://localhost:8080/site/api/documents](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](http://localhost:8080/site/api-preview/documents)  
i am able to see the unpublished data.😃

---

<div class="post-metadata">

**Author:** ![ponnuru765](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/ponnuru765/32/421_2.png) [@ponnuru765](https://community.bloomreach.com/u/ponnuru765)\
**Post date:** [August 9, 2019, 6:37pm UTC](https://community.bloomreach.com/t/how-to-access-unpublished-data-from-rest-calls/1218/6 "2019-08-09T18:37:50Z")

</div>

it works when i access able to see all documents.  
[http://localhost:8080/site/api-preview/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](http://localhost:8080/site/api-preview/documents/83fd1f43-0567-4cc3-b01b-6adb3cdc1c37)  
it is empty is their any way to handle child’s

{

- name: “secondary-nav”,

- id: “83fd1f43-0567-4cc3-b01b-6adb3cdc1c37”,

- link: {

- type: “myproject:SampleMenu”,

- locale: “en”

}
