Skip to content

Commit

Permalink
docu
Browse files Browse the repository at this point in the history
issue #289
  • Loading branch information
rsoika committed Aug 8, 2017
1 parent 9ea5547 commit 018de89
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/site/markdown/restapi/restclient.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# The Imixs RestClient

The Imixs-RestClient is a helper class to establish connections to the Imixs Rest API.
This is a simple example how to request the tasklist of a user:

// create RestClient ....
RestClient restClient = new RestClient();
try {
restClient.setRequestProperty("Accept", MediaType.APPLICATION_XML);
restClient.get("http://localhost:8080/workflow/rest-service/workflow/tasklist/owner/admin");
String xmlResult = restClient.getContent();
JAXBContext context = JAXBContext.newInstance(DocumentCollection.class);
Unmarshaller u = context.createUnmarshaller();
StringReader reader = new StringReader(xmlResult);
DocumentCollection xmlDocuments = (DocumentCollection) u.unmarshal(reader);
List<ItemCollection> documents = XMLItemCollectionAdapter.getCollection(xmlDocuments);
logger.info("Read " + documents.size() + " documents");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

## Set Credentials

The Imixs-RestClient also upports BASIC authentication. In this case the *principal* and *credentials* can be set.

RestClient restClient = new RestClient();
restClient.setUser("admin");
restClient.setPassword("password");
...
1 change: 1 addition & 0 deletions src/site/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
</item>
<item name="Document Service" href="./restapi/documentservice.html" />
<item name="JSON" href="./restapi/json.html" />
<item name="RestClient" href="./restapi/restclient.html" />
</item>


Expand Down

0 comments on commit 018de89

Please sign in to comment.