Skip to content

Api Sources Post

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

Create Source Instance

A new source will be created. The only information required from the user is the url of the source.

These are some request examples:

  • A OAI-PMH repository:
{
    "url": "oaipmh://oa.upm.es/perl/oai2"
}
  • A RSS feed:
{
    "url": "rss://rss.slashdot.org/Slashdot/slashdot"
}
  • A ZIP file from DropBox:
{
    "url": "https://dl.dropboxusercontent.com/u/132555/library/papers.zip"
}

Once the request is accepted by the API module, a HTTP 202 response will be answered indicating that the instruction was accepted and the resource was marked for the creation (more details here).

An internal event-message is sent to routing-key source.new to publish this action and both the Harvester and the Hoarder module, which are listening for that type of events, will start to make the related operations.

event-source-new

Request

POST http://zavijava.dia.fi.upm.es:8888/api/sources/
HEADER:
  Authorization: 70b88ce0-9cb8-23e5-62dd-0002a4d3c52c
Content-Type: application/json
{
    "url": "oaipmh://oa.upm.es/perl/oai2"
}
  • curl:
curl -i -X POST -H "Authorization: 70b88ce0-9cb8-23e5-62dd-0002a4d3c52c" -d "{ 'url': 'oaipmh://oa.upm.es/perl/oai2'}" http://zavijava.dia.fi.upm.es:8888/api/sources

Response

202 Accepted
{
    "uri": "sources/11111111-2222-3333-4444-555555555555"
}
Clone this wiki locally