Recent Posts

Featured Posts

AIFdb Social Layer web services last updated December 28, 2016 by Mark

AIFdb Social Layer web services

The AIFdb social layer allows user information to be associated with resources in AIFdb.

POST /social/user

Fields:
email (required) – the user’s email address
password (required) – the user’s password
firstname (required) – the user’s first name
surname (required) – the user’s surname
userInfo (option) – user info: JSON object containing additional information in “key”:”value” pairs – see example

Description:
Create a new user.

Example:

curl -d ‘{“email”:”user@aifdb.org”,”password”:”userpass”,”firstname”:”Joe”,”surname”:”Bloggs”, “userInfo”:{“address”:”Dundee”,”date-of-birth”:”1-1-1970″}’ http://aifdb.org/social/user

{“userID”:672,”hash”:”631cb0bedf3c72380969a2a7c328b5b3″,”email”:”user@aifdb.org”,
“surname”:”Bloggs”,”firstname”:”Joe”,”userInfo”:{},”info”:[],”personID”:1635}

GET /social/user/{userID}
GET /social/user/me
GET /social/user/all

Description:
Get user information: about the user with {userID}, the currently authenticated user, or all users

Examples:

curl -u user@aifdb.org:userpass http://aifdb.org/social/user/3

{“userID”:3,”email”:”msnaith@dundee.ac.uk”,”surname”:”Snaith”,”firstname”:”Mark”,”userInfo”:{“address”:”Dundee”,”date of birth”:”October”},”info”:[{“name”:”address”,”value”:”Dundee”,”infoID”:1},{“name”:”date of birth”,”value”:”October”,”infoID”:2}],”personID”:288}

curl -u user@aifdb.org:userpass http://aifdb.org/social/user/me

{“userID”:672,”hash”:”631cb0bedf3c72380969a2a7c328b5b3″,”email”:”user@aifdb.org”,”surname”:”Bloggs”,”firstname”:”Joe”,”userInfo”:{},”info”:[],”personID”:1635}

Note: the “info” JSON array is deprecated and exists for legacy purposes only. New applications should access user information via the “userInfo” array.

GET /saif/json/{nodesetID}

Description:
Get the Social AIF associated with an AIFdb nodeset.

Example (excerpt):

curl http://aifdb.org/saif/json/4471

{“users”:[{“userID”:3,”email”:”[redacted]”,”surname”:”Snaith”,”firstname”:”Mark”,”userInfo”:{“address”:”Dundee”,”date of birth”:”October”},”info”:[{“name”:”address”,”value”:”Dundee”,”infoID”:1},{“name”:”date of birth”,”value”:”October”,”infoID”:2}],”personID”:288}],”userLocutions”:[{“userID”:3,”appID”:1,”locutionID”:63169},{“userID”:3,”appID”:1,”locutionID”:63176},{“userID”:3,”appID”:1,”locutionID”:63182},{“userID”:3,”appID”:1,”locutionID”:63188}],”applications”:[{“appName”:”ArguBlogging”,”appID”:1}]}

POST /saif/store

Description:
Add Social AIF to the database; the social aspects will be added to the Social Layer and the core AIF will be added to AIFdb. Social aspects should be in the form that comes out of the Social Layer (see above) as part of the AIF object.

Example:

curl -u user@aifdb.org:userpass –data ‘@/Users/mark/Documents/social.json’ http://aifdb.org/social/saif/store

{“status”:”OK”,”nodeset”:9384}