Skip to content

4. Backend API

Roderick Gadellaa edited this page Dec 21, 2015 · 10 revisions

Overview

Called such for lack of a better word. Basically it's a PHP backend that the readers talk to. You may run your own server for this or use mine (nfcpyr.rejh.nl/api/)

More docs coming soon. Have a look at the code in src/www for now.


Queries

###Checkins

checkinout

?a=checkincheckout&q={"reader_id":"reader_id","username":"username}&key=authkey

Toggles checkin status for reader_id > username

Returns (obj) $json["checkins"][$reader_id][$username]

checkin

?a=checkin&q={"reader_id":"reader_id","username":"username}&key=authkey

Checks in for reader_id > username

Returns (obj) $json["checkins"][$reader_id][$username]

checkout

?a=checkou&q={"reader_id":"reader_id","username":"username}&key=authkey

Checks out for reader_id > username

Returns (obj) $json["checkins"][$reader_id][$username]

###Users

get_users

?a=get_users&key=authkey

Get user data

Returns (list) $json["users"]

more_docs_todo

###Readers

get_readers

?a=get_readers&key=authkey

Get readers data

Returns (list) $json["readers"]

more_docs_todo


Errors

h2. Errors

CODE DESCRIPTION
1 Default error, see 'errormsg' field for a description
100 Auth error, see 'errormsg' field for a description
101 Authkey does not exist, use 'get_authkey' to request a new one [1]
102 Authkey cannot be found with given credentials (nfcpyr_id, user, pass), use 'get_new_authkey' [1]

[1] Provide nfcpyr_id, user and pass

Clone this wiki locally