APIs description

WMArchive is a RESTful service, therefore clients can use any tool/language to contact the service and use GET/POST HTTP requests to retrive or post their data. Below we provide examples for curl and python clients.
Curl client
POST requests can be used to query documents in WMArchive
# define some parameters
OUT=/dev/stdout
HEADERS="Content-type: application/json"
URL=http://hostname:port/wmarchive/data

# prepare your query.json file
{"spec":{"task":"AbcCde09[0-9]", "timerange":[20160101,20160102]}, "fields":["task"]}

# single document injection, POST request
curl -D $OUT -X POST -H $HEADERS -d query.json $URL

# depending on provided timerange you'll either get results
# or you'll be given UID of your request which can be used later
# to locate your results
GET requests can be used to fetch results from WMArchive placed previously via POST request
# single document retrieval, GET request for provided UID
curl -D $OUT -H $HEADERS $URL/UID
Python client
import os, json, httplib

# get connection to our service
conn = httplib.HTTPConnection(host, port)

# get data from WMArchive
query = dict(spec={"task":"taskName", "timerange":[20160101,20160102]}, fields=["task"])
conn.request("POST", path, json.dumps(query), headers)
response = conn.getresponse()
print("STATUS", response.status, "REASON", response.reason)

# read our results
res = response.read()
data = json.loads(res)