Likes are a unique creature in the sense that they are not a standalone object. They mean very little outside of the context of the object that those 'likes' belong. Because of this, Schoology architected the like operations in the following manner:
- Viewing Likes: A user can view the likes associated with any given object as well as their like state by looking at the values in
"user_like_actions" : true, "likes" : 4
inside the body of any piece of content that can be "liked" - Creating a like: A user can like either an update post or a comment using one of the POST endpoints below.
Operations
create
Like an update
Path | POST https://api.schoology.com/v1/like/{id} |
Content |
An object indicating what sort of like action the user would like to take JSON{ "like_action": "true" }XML <body> <like_action>true</like_action> </body> |
Return | An object returning the two like fields included in all objects. {"likes" : 2, "user_like_action" : true}
JSON { "likes": 1, "user_like_action": true }XML <?xml version="1.0" encoding="utf-8" ?> <result> <likes>1</likes> <user_like_action>1</user_like_action> </result> |
create
Like a comment object
Path | POST https://api.schoology.com/v1/like/{id}/comment/{comment_id} |
Content |
An object indicating what sort of like action the user would like to take JSON{ "like_action": "true" }XML <body> <like_action>true</like_action> </body> |
Return | An object returning the two like fields included in all objects. {"likes" : 2, "user_like_action" : true} JSON { "likes": 1, "user_like_action": true }XML <?xml version="1.0" encoding="utf-8" ?> <result> <likes>1</likes> <user_like_action>1</user_like_action> </result> |
list
View a list of users who liked an update
Path | GET https://api.schoology.com/v1/like/{id} |
Content | |
Return | A list of user objects
JSON { "total": 0, "links": { "self": "http:\/\/...?start=0&limit=20" }, "users": [ { "uid": "45552", "id": 45552, "school_id": 344232, "synced": 0, "school_uid": "", "name_title": "", "name_title_show": 0, "name_first": "Mr.", "name_first_preferred": "", "name_middle": "", "name_middle_show": 0, "name_last": "Strickland", "name_display": "Mr. Strickland", "username": "mrstrickland", "primary_email": "", "picture_url": "http:\/\/...?1385138746", "grad_year": "", "password": "", "role_id": 0, "tz_offset": -4, "tz_name": "America\/New_York", "parents": null, "child_uids": null } ] }XML <?xml version="1.0" encoding="utf-8" ?> <result> <total>0</total> <links> <self>http:\/\/...?start=0&limit=20</self> </links> <users> <uid>45552</uid> <id>45552</id> <school_id>344232</school_id> <synced>0</synced> <school_uid /> <name_title /> <name_title_show>0</name_title_show> <name_first>Mr.</name_first> <name_first_preferred /> <name_middle /> <name_middle_show>0</name_middle_show> <name_last>Strickland</name_last> <name_display>Mr. Strickland</name_display> <username>mrstrickland</username> <primary_email /> <picture_url>http:\/\/...?1385138746</picture_url> <grad_year /> <password /> <role_id>0</role_id> <tz_offset>-4</tz_offset> <tz_name>America/New_York</tz_name> <parents /> <child_uids /> </users> </result> |
list
View a list of users who liked a comment object
Path | GET https://api.schoology.com/v1/like/{id}/comment/{comment_id} |
Content | |
Return | A list of user objects JSON { "total": 0, "links": { "self": "http:\/\/...?start=0&limit=20" }, "users": [ { "uid": "45552", "id": 45552, "school_id": 344232, "synced": 0, "school_uid": "", "name_title": "", "name_title_show": 0, "name_first": "Mr.", "name_first_preferred": "", "name_middle": "", "name_middle_show": 0, "name_last": "Strickland", "name_display": "Mr. Strickland", "username": "mrstrickland", "primary_email": "", "picture_url": "http:\/\/...?1385138746", "grad_year": "", "password": "", "role_id": 0, "tz_offset": -4, "tz_name": "America\/New_York", "parents": null, "child_uids": null } ] }XML <?xml version="1.0" encoding="utf-8" ?> <result> <total>0</total> <links> <self>http:\/\/...?start=0&limit=20</self> </links> <users> <uid>45552</uid> <id>45552</id> <school_id>344232</school_id> <synced>0</synced> <school_uid /> <name_title /> <name_title_show>0</name_title_show> <name_first>Mr.</name_first> <name_first_preferred /> <name_middle /> <name_middle_show>0</name_middle_show> <name_last>Strickland</name_last> <name_display>Mr. Strickland</name_display> <username>mrstrickland</username> <primary_email /> <picture_url>http:\/\/...?1385138746</picture_url> <grad_year /> <password /> <role_id>0</role_id> <tz_offset>-4</tz_offset> <tz_name>America/New_York</tz_name> <parents /> <child_uids /> </users> </result> |