Use the MCF API

Valid as of 4.0

This documentation below is valid for Datafari 4.0

There is a REST API that you can use to control ManifoldCF.

All the documentation is here : https://manifoldcf.apache.org/release/release-2.10/en_US/programmatic-operation.html

In this page we explain how to use it into Datafari.

First the url to access to the API :

Normally the web app name is "mcf-api-service", in Datafari the call will be :

http://DATAFARI_URL:8080/datafari-mcf-api-service/xxx

You have to authenticate yourself for using the API. During the Datafari installation, the same password is settled to MCF admin UI and the MCF API so you have to use this password.

If you want to use CURL for example, the command is :

curl -c "cookie" -XPOST 'http://localhost:8080/datafari-mcf-api-service/json/LOGIN' -d @/root/mcf/user.json

The user.json is like this :

{ "userID":"", "password":"xxx" }

Replace xxx by your MCF password. We store the JSESSIONID into the cookie named cookie to reuse it for the next API commands.

So you need to always have this first call before your other commands.

For example if I want to add a new repository connection, the commands will be :

curl -c "cookie" -XPOST 'http://localhost:8080/datafari-mcf-api-service/json/LOGIN' -d @/root/mcf/user.json curl -b "cookie" -XPUT 'http://localhost:8080/datafari-mcf-api-service/json/repositoryconnections/Files' -d @/root/mcf/Files.json

Finally, if you want you can deactivate the security on the MCF API commands. Edit /opt/datafari/mcf/mcf_home/properties.xml and comment or delete the line :

<property name="org.apache.manifoldcf.apilogin.password.obfuscated" value="xxx"/>