Skip to content

Api 4steps

Carlos Badenes edited this page Mar 31, 2016 · 1 revision

This guide is for impatients, so here you have all the information to add documents and explore them quickly. Let's go!

0. Create the user

Or use the authorization token if user was already created:

curl -i -X POST -d "{ 'email': '[email protected]'}" http://localhost/api/users

1. Create the source

We have the documents packed in a zip file in dropbox or in a ftp server or in a shared folder in LAN. So, you need to create a new source with that url:

curl -i -X POST -H "Authorization: 70b88ce0-9cb8-23e5-62dd-0002a4d3c52c" -d "{ 'name': 'myFirstSource', 'url':'https://dl.dropboxusercontent.com/u/111111/corpus.zip'}" http://zavijava.dia.fi.upm.es:8888/api/sources

At this point, both a hoarder and a harvester task will be initialized to download and to extract the file adding the inner documents in the system.

2. Create the domain

At the same time or after, we can create a domain with all the documents downloaded from that source:

curl -i -X POST -H "Authorization: 70b88ce0-9cb8-23e5-62dd-0002a4d3c52c" -d "{'name':'myFirstDomain', 'documents': { 'source': { 'name' : 'myFirstSource'}}" http://zavijava.dia.fi.upm.es:8888/api/domains

This domain is dynamic, i.e. when new documents are added from myFirstSource, they also are included in myFirstDomain.

3. Close the domain

Well, the domain must be closed to be analyzed (See Domain States). This is an automatic task done when no new documents have been added to a domain for a time (about 20 minutes). However, if you know the number of documents to add, you can close it as soon as all of them are added.
First, check how many of them have been added to the domain in a time:

curl -i -X GET -H "Authorization: 70b88ce0-9cb8-23e5-62dd-0002a4d3c52c" http://zavijava.dia.fi.upm.es:8888/api/domains/myFirstDomain?fields=size

And, when it will be complete, close it:

curl -i -X PUT -H "Authorization: 70b88ce0-9cb8-23e5-62dd-0002a4d3c52c" -d "{'status':'close'}" http://zavijava.dia.fi.upm.es:8888/api/domains/myFirstDomain/status

4. Explore!!

When the system perform the analyzing and learning tasks, you'll can to check the entities, models, terms, relations and more elements in that domain.
See some of the common searches to be inspired.

Clone this wiki locally