Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jreijn/hippo-addon-restful-webservices

This project provides webservices against the Hippo CMS content repository
https://github.com/jreijn/hippo-addon-restful-webservices

hippo-cms

Last synced: about 1 month ago
JSON representation

This project provides webservices against the Hippo CMS content repository

Awesome Lists containing this project

README

        

# Hippo RESTful web services add-on

[![Build Status](https://travis-ci.org/jreijn/hippo-addon-restful-webservices.png?branch=master)](https://travis-ci.org/jreijn/hippo-addon-restful-webservices)
[![Coverage Status](https://coveralls.io/repos/jreijn/hippo-addon-restful-webservices/badge.png?branch=master)](https://coveralls.io/r/jreijn/hippo-addon-restful-webservices?branch=master)

This project is a pragmatic approach to provide web services on top of the Hippo CMS repository.

It provides amongst others a full CRUD API for JCR nodes and properties.

## Current Available APIs

Version 0.3.X

+ Info ```/```
+ Nodes API ```/nodes```
+ Properties API ```/properties```
+ Query API ```/_query```
+ System API ```/_system```
+ Statistics API ```/_stats```
+ Users API ```/users```
+ Groups API ```/groups```

The resources have been defined into two types:

+ CRUD resources (without underscore)
+ Non-CRUD resources (with underscore)

If you would like to know more about how to use the REST endpoints go ahead and read the [API Reference section](https://github.com/jreijn/hippo-addon-restful-webservices/wiki/API-Reference).

## Using the web services in your project

See for a working demo the [sample project](https://github.com/jreijn/hippo-addon-restful-webservices-demo).

To install this project into a local project you need to add the web services dependency to your projects _cms_ module located in ```cms/pom.xml```

``` xml

org.onehippo.forge.webservices
hippo-addon-restful-webservices
0.3.1

```

Now add the servlet definition to your CMS web.xml located in ```cms/src/main/webapp/WEB-INF/web.xml```.

``` xml

RepositoryWebServicesServlet
org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet

jaxrs.serviceClasses

org.onehippo.forge.webservices.jaxrs.RootResource,
org.onehippo.forge.webservices.jaxrs.system.SystemResource,
org.onehippo.forge.webservices.jaxrs.jcr.NodesResource,
org.onehippo.forge.webservices.jaxrs.jcr.PropertiesResource,
org.onehippo.forge.webservices.jaxrs.jcr.QueryResource,
org.onehippo.forge.webservices.jaxrs.StatsResource,
org.onehippo.forge.webservices.jaxrs.management.UsersResource,
org.onehippo.forge.webservices.jaxrs.management.GroupsResource



jaxrs.providers

org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider,
org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter,
org.onehippo.forge.webservices.jaxrs.exception.CustomWebApplicationExceptionMapper,
org.onehippo.forge.webservices.jaxrs.CustomJacksonConfig,
org.onehippo.forge.webservices.HippoAuthenticationRequestHandler



jaxrs.extensions
json=application/json, xml=application/xml

6

```

We will also need to add the servlet mapping, so that the API is exposed at _/rest/api_ :

``` xml

RepositoryWebServicesServlet
/rest/api/*

```

That's it. Now the web services should be available. In case you are using the default archetype you should be able to get
a response by calling the root endpoint [http://localhost:8080/cms/rest/api/](http://localhost:8080/cms/rest/api/)

For a working example see this the [demo project repository](https://github.com/jreijn/hippo-addon-restful-webservices-demo) on GitHub.

## Building from source

This plugin requires [Maven](http://maven.apache.org) to build the module from source.

After you have installed Maven you can build the module with:

``` console
$ mvn install
```

## Issues, Questions or improvements

If you find any problems, have a question or see a possibility to improve the add-on please browse the [project issues](https://github.com/jreijn/hippo-addon-restful-webservices/issues).

## Contributions

Pull requests are, of course, very welcome! Head over to the [open issues](https://github.com/jreijn/hippo-addon-restful-webservices/issues) to see what we need help with. Make sure you let us know if you intend to work on something. Also, check out the [milestones](https://github.com/jreijn/hippo-addon-restful-webservices/issues/milestones) to see what is planned for future releases.