Nuxeo Server

Contributing a New Endpoint

Updated: November 13, 2017 Page Information Edit on GitHub

It is possible to contribute a new endpoint to the API by creating new web objects.

Thanks to WebEngine and its pluggability, we've provided a way to add other root endpoints that benefit from the same infrastructure. It's just a matter of providing a web object in another bundle, like the following:

@WebObject(type="productRoot")
public class ProductRoot {

    @GET
    public List getProducts() throws ClientException {
        ProductService ps = Framework.getLocalService(ProductService.class);
        return ps.getAllProducts(getContext().getCoreSession());
    }

    @Path("{productId}")
    public Object getProduct(@PathParam("productId") String productId) {
       return newObject("product", productId);
    }

}

This will expose two new APIs:

GET /nuxeo/api/v1/product
GET /nuxeo/api/v1/product/{productId}

Since Document Adapters are used as return types, the API will automatically benefit from the integrated adapter serializations (readers and writers). That means that it's very easy to build your own API and you inherit all the other pluggability mechanisms.

5 days ago manonlumeau Added content-review-lts2017 label
a month ago manonlumeau NXDOC-1346-FT review screenshot
4 years ago Solen Guitter 7
4 years ago Solen Guitter 6
4 years ago Alain Escaffre 5
4 years ago Alain Escaffre 2
4 years ago Alain Escaffre 3
4 years ago Alain Escaffre 4
4 years ago Alain Escaffre 1
History: Created by Alain Escaffre