# CRUD content via rest api

**URL:** <https://community.bloomreach.com/t/crud-content-via-rest-api/1525>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [October 29, 2019, 10:03am UTC](https://community.bloomreach.com/t/crud-content-via-rest-api/1525 "2019-10-29T10:03:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohammad\_1m2](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/mohammad_1m2/32/536_2.png) [@mohammad\_1m2](https://community.bloomreach.com/u/mohammad_1m2)\
**Post date:** [October 29, 2019, 10:03am UTC](https://community.bloomreach.com/t/crud-content-via-rest-api/1525/1 "2019-10-29T10:03:55Z")

</div>

Hello  
I want to create some new content like new document via rest api. Is there any rest api like POST `api/content/documents` or `api/content/gallery` to save new document or image in the cms?  
I see [this post](https://community.bloomreach.com/t/is-it-possible-to-create-update-a-content-document-in-hippo-with-rest-api/830) but I want some api like [this](https://www.jeroenreijn.com/2015/02/a_rest_api_for_the_hippocms_content_repository.html) for managing all entity like node, property, user and group. [This plugin](https://www.jeroenreijn.com/2015/02/a_rest_api_for_the_hippocms_content_repository.html) did not compatible with bloomreach 13. Is there a similar one for bloomreach 13? If no how can I write some api like this?  
Thanks.

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [October 29, 2019, 10:40am UTC](https://community.bloomreach.com/t/crud-content-via-rest-api/1525/2 "2019-10-29T10:40:05Z")

</div>

Hi,

You have two options to implement and expose JAX-RS based REST services:

- Repository JAX-RS Service [1]
- Plain JAX-RS Services [2]

The former one is deployed on /cms application, whereas the latter is on /site application. The former with built-in Basic authentication, the latter without built-in authentication - but you can add authentication through Spring Security and integration addon module [3] for example.

REST endpoints allow you to expose URLs, input and output params, so you need to use a API or library to create documents in repository. Content-EXIM [4] is a good library in any choices. For example, the groovy code example with the library [5] is a good source to reuse.

Regards,

Woonsan

[1] [https://documentation.bloomreach.com/library/concepts/hippo-services/repository-jaxrs-service.html](https://documentation.bloomreach.com/library/concepts/hippo-services/repository-jaxrs-service.html)  
[2] [https://documentation.bloomreach.com/library/concepts/rest/restful-api-support---plain-jax-rs-services.html](https://documentation.bloomreach.com/library/concepts/rest/restful-api-support---plain-jax-rs-services.html)  
[3] [https://bloomreach-forge.github.io/hst-spring-security/](https://bloomreach-forge.github.io/hst-spring-security/)  
[4] [https://bloomreach-forge.github.io/content-export-import/](https://bloomreach-forge.github.io/content-export-import/)  
[5] [https://bloomreach-forge.github.io/content-export-import/tutorials-import-docs.html](https://bloomreach-forge.github.io/content-export-import/tutorials-import-docs.html)

---

<div class="post-metadata">

**Author:** ![mohammad\_1m2](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/mohammad_1m2/32/536_2.png) [@mohammad\_1m2](https://community.bloomreach.com/u/mohammad_1m2)\
**Post date:** [November 3, 2019, 11:42am UTC](https://community.bloomreach.com/t/crud-content-via-rest-api/1525/3 "2019-11-03T11:42:35Z")

</div>

Thanks.  
For adding repository jaxrs service I add new module and a class like [documentation](https://documentation.bloomreach.com/library/concepts/hippo-services/repository-jaxrs-service.html). After build and run project, the api return

> No service was found

I add the new maven module in root of project. Then add the provided dependency and api class. Is there any sample project?

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [November 4, 2019, 4:01am UTC](https://community.bloomreach.com/t/crud-content-via-rest-api/1525/4 "2019-11-04T04:01:55Z")

</div>

> [@mohammad\_1m2](#):
>
> Is there any sample project?

Perhaps there are better ones, but I have this: Content EXIM Built-in REST Services

- [Hippo Content EXIM (EXport/IMport) Documentation – Built-in REST Services](https://bloomreach-forge.github.io/content-export-import/builtin-rest-services.html)

Click on “Fork me on GitHub” ribbon and browse the “repository-jaxrs” submodule.

Regards,

Woonsan

---

<div class="post-metadata">

**Author:** ![Thomas](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/thomas/32/753_2.png) [@Thomas](https://community.bloomreach.com/u/Thomas)\
**Post date:** [January 18, 2020, 12:34pm UTC](https://community.bloomreach.com/t/crud-content-via-rest-api/1525/5 "2020-01-18T12:34:17Z")

</div>

I get this message even with the sample project (conten-exim) !  
Any additional tipps ??

I found out that the url I used was wrong:  
instead of **[http://localhost:8080/cms/ws/exim/export](http://localhost:8080/cms/ws/exim/export)**, I used **[http://localhost:8080/cms/ws/export](http://localhost:8080/cms/ws/export)**

Consuming the webservice via **curl** , as described with the sample-project - works fine (I am only not able the read the zip-file).

But how can I consume the webservice via a http-client. I am using YARC to test it. With the following header I get a 400-response!

this is my request-header:

```
    {
        "method": "POST",
        "transformRequest": [
         null
         ],
        "transformResponse": [
         null
         ],
         "url": "http://localhost:8080/cms/ws/exim/export",
         "headers": {
            "paramsJson": "{ documents: { queries: [ 
             '/jcr:root/content/documents//element(*,hippo:document)' ] } }",
          "Content-Type": "multipart/form-data",
          "Accept": "application/octet-stream",
          "Authorization": "Basic YWRtaW46YWRtaW4="
       },
       "data": "",
       "timeout": {}
    }

```

What is wrong with the request ?

---

<div class="post-metadata">

**Author:** ![Thomas](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/thomas/32/753_2.png) [@Thomas](https://community.bloomreach.com/u/Thomas)\
**Post date:** [January 28, 2020, 5:56pm UTC](https://community.bloomreach.com/t/crud-content-via-rest-api/1525/6 "2020-01-28T17:56:10Z")

</div>

In the meanwhile I found the solution and I woud like to share it with the community.  
The paramsJson has to go in the data section as payload!

`"data": "paramsJson = \"{ documents: { queries: ['/jcr:root/content/documents//element(*,hippo:document)'] } }\""`

---

<div class="post-metadata">

**Author:** ![Param](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/param/32/1171_2.png) [@Param](https://community.bloomreach.com/u/Param)\
**Post date:** [January 20, 2022, 4:23am UTC](https://community.bloomreach.com/t/crud-content-via-rest-api/1525/7 "2022-01-20T04:23:27Z")

</div>

Hey Woonsan,

Greetings

As per your suggestion, we are using _ **" Content EXIM Built-in REST Services"** _ for CRUD operations like **Create-item, Get-Item, Publish-item**. Somewhere while achieving this, We are having issues in modifying an item using **“PUT”**. Every time hitting **“PUT”** to modify field values it **changes the UUID**.

I’m very thankful If you can help here or suggest something.

- [https://bloomreach-forge.github.io/content-export-import/builtin-rest-services.html](https://bloomreach-forge.github.io/content-export-import/builtin-rest-services.html)

Thanks  
Param

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [January 20, 2022, 5:04am UTC](https://community.bloomreach.com/t/crud-content-via-rest-api/1525/8 "2022-01-20T05:04:46Z")

</div>

CMS workflow may updates the UUIDs of a document variant node or descendant nodes at any time, but its handle node’s (parent node of the document variant nodes) uuid will never change.

Regards,

Woonsan
