How to Use Quepid's API
Accessing the Quepid API like http://localhost:3000/api/cases/5.json is protected by you logging in and having the appropriate cookies set.
But what if we want to have an automated process? Then you need to create a Personal Access Token.
Go to your Profile page and scroll down to the Personal Access Tokens section:
Click the Generate New Token and you will get a token that is specific to you that lets you interact with Quepid's API:
Here is an example of looking up information about a Case by it's id:
curl -X GET -H 'Authorization: Bearer 53e41835979d649775243ababd4312e8' http://localhost:3000/api/cases/5.json
>> {"name":"Book of Ratings","book_id":1,"query_doc_pairs":[{"query_doc_pair_id":1,"position":1,"query":"adsf","doc_id":"asdf","judgements":[]}]}%
Here is an example of creating a query doc pair for a book by it's ID:
curl -X POST http://localhost:3000/api/books/2/query_doc_pairs/ -H 'Authorization: Bearer 4a82040bf1b2d255c63833cb59fa9275' -H 'Content-Type: application/json' -d '{
"query_doc_pair": {
"document_fields": "{title:My Document}",
"query_text": "my search",
"doc_id": "some_special_doc_id_52",
"position": 1
}
}'
And of course an example of programmatically creating a judgement:
curl -X POST http://localhost:3000/api/books/2/judgements/ -H 'Authorization: Bearer 4a82040bf1b2d255c63833cb59fa9275' -H 'Content-Type: application/json' -d '{
"judgement": {
"query_doc_pair_id": 201
"rating": 1
}
}'