In this post you will find all the details to take advantage of this API and interact with it from Java or Groovy using Apache HttpComponents 4.x.

The Apache HttpComponents project is responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols.This project functions under the Apache Software Foundation, and is part of a larger community of developers and users.

Interacting With the RESTful API

Bellow we will see how to send GET, POST, PUT and DELETE HTTP requests to the XWiki REST service using Apache HttpComponents.

Note that the XWiki RESTful API supports HTTP basic authentication. This method will be used to authenticate the Apache HttpClient to reach or update XWiki resources that needs authentication.

Get resources without authentication

In this example, a GET http request will be sent to the XWiki REST service.