-
Notifications
You must be signed in to change notification settings - Fork 11
Messages
Matthew Taylor edited this page Nov 1, 2017
·
13 revisions
Returns the number of unread messages for a user. To be released.
- Response format:
JSON
https://api.scratch.mit.edu/users/:username/messages/count
- :username – the username of the user for whom to get information
curl -X GET "https://api.scratch.mit.edu/users/mres/messages/count"
{
"count": 0
}
Returns messages for the given user. These are data used to generate notifications that would appear on a user's /messages
page on the Scratch website.
- This endpoint requires authentication. A user is only able to see messages for themselves.
- Types of messages that are included in this response
addcomment
forumpost
loveproject
favoriteproject
followuser
curatorinvite
becomeownerstudio
remixproject
studioactivity
userjoin
https://api.scratch.mit.edu/users/:username/messages
- :username – the username of the user for whom to get messages
-
limit – integer value representing the number of messages to limit the response to.
- Maximum value:
40
- Default value:
20
- Maximum value:
-
offset – integer value representing where in the list of the your messages to start retrieving from. Messages are returned in order of when they were created starting with the most recent, so if
offset=5
, then the response will start with the 5th most recently created message.- Default value:
0
- Default value:
-
filter – string value representing the type of messages you'd like to see. Example: if one specifies
comments
as the filter value, then the only messages that will be retrieved are ones relating to comments.- Possible values:
all, comments, projects, studios, forums
- Default value:
all
- Possible values:
curl -X GET "https://api.scratch.mit.edu/users/mres/messages"
[
{
"datetime_created": "2017-10-31T20:28:56.000Z",
"comment_type": 1,
"comment_fragment": "Hufflepuff is here too! We are also totally a house!",
"type": "addcomment",
"actor_id": 00000000,
"actor_username": "<username>",
"comment_id": 00000000,
"comment_obj_id": 00000000,
"comment_obj_title": "<username>",
"id": 00000000,
"recipient_id": 00000000
},
{
"datetime_created": "2017-10-31T16:21:14.000Z",
"topic_title": "Coolest things found in the Room of Requirement",
"type": "forumpost",
"actor_id": 00000000,
"actor_username": "<username>",
"id": 00000000,
"recipient_id": 00000000,
"topic_id": 00000000
},
{
"datetime_created": "2017-10-31T01:55:36.000Z",
"comment_type": 0,
"comment_fragment": "My name's Dave and I was also at Hogwarts with HP. We were acquaintances.",
"type": "addcomment",
"actor_id": 00000000,
"actor_username": "<username>",
"comment_id": 00000000,
"comment_obj_id": 00000000,
"comment_obj_title": "<project title>",
"id": 00000000,
"recipient_id": 00000000
}
]