mark_read via REST

(Andrew Byrne) #1

So notifications are awesome. Just putting it out there.
But the notifications.json REST returns a value {read : false} which I cannot (for the life of me) seem to switch.

I have noted

But have no idea ( after much trying) how or even if this can be set (PUT) via REST?

(Andrew Byrne) #2

Shout out to @cpradio for the pointer.

This is covered in

Solution in short is a PUT

will mark all notifications as read. Still working on a selective mark read but its a great start.

(Kane York) #3

You want to either send read timings for the relevant post, or make a request for the relevant badges page.

(Andrew Byrne) #4

Awesome enjoying the love here!
So i have tried a couple of thing to no avail.

  1. message timing

  2. Poll
    /message-bus/poll.json? + form data…

Both were pinched (with modifications) from the network panel but neither see to effect the notifications feed?

“notifications”: [
“id”: 130,
“notification_type”: 2,
“read”: false,
“created_at”: “2015-07-14T00:21:36.672Z”,

(Andrew Byrne) #5

OK so @riking was right.
Just a little more detail and we are there.

Note I have already updated the wiki here -

selectively mark notifications read

POST /topics/timings.json
POST Body - topic_id=1234&topic_time=1234&timings[X]=1234
Where X = post_number to mark read

note: this accepts multiple posts (based on comment a user is viewing) eg.

curl -X POST -d  topic_id=1234 -d  topic_time=1234 -d  timings[1]=1234 -d  timings[2]=1234 -d  timings[3]=1234 http://localhost:3000 /topics/timings.json?api_key=test_d7fd0429940&api_username=test_user

will mark comments 1, 2 and 3 read on the topic 1234