FreshRSS / FreshRSS

A free, self-hostable news aggregator…
https://freshrss.org
GNU Affero General Public License v3.0
8.77k stars 780 forks source link

[Bug] Mark as read using GReader API #6448

Closed dbastide closed 1 month ago

dbastide commented 1 month ago

Describe the bug

Hi,

I am trying to mark articles are read using the GReader API. I tried it several ways, the API responds with OK but the article isn't actually marked as read.

To Reproduce

I am using postman to test the API:

baseUri=https://rss.cheredeprince.net/api/greader.php user=myUsername apiKey=myApiKey

  1. I get the token with POST {{baseUri}}/accounts/ClientLogin?Email={{user}}&Passwd={{apiKey}} It looks like Auth=myUsername/<secret> In the next requests I pass the Authorization header with value = GoogleLogin auth=myUsername/<secret>

  2. I get the unread articles with GET {{baseUri}}/reader/api/0/stream/contents/reading-list?n=10&xt=user/-/state/com.google/read I get (removed some parts): image

  3. I get the item ids in a different way with GET {{baseUri}}/reader/api/0/stream/items/ids?n=10&xt=user/-/state/com.google/read&output=json&s=feed/6 I get: {"itemRefs":[{"id":"1715223762824912"}]}

  4. I get the write token with GET {{baseUri}}/reader/api/0/token I get: <secret>ZZZZZZZZZZZZZZZZZ

  5. I proceed to marking that article as read with: POST {{baseUri}}/reader/api/0/edit-tag

As form data: image

As raw post data: image

As query parameters: image

I tried also different variants, passing the item ID as tag:google.com,2005:reader/item/000617fca717eed0and also as 1715223762824912, also trying to specify the feed with s param (value feed/6)

In each case, I get OK but the article is not marked as read. Am I doing something wrong or the GReader API doesn't support this and I should try out the Fever API instead?

Expected behavior

The article should be marked as read.

FreshRSS version

1.21.1-dev

Environment information

I am using the server at https://rss.cheredeprince.net/

Additional context

No response

Frenzie commented 1 month ago

Am I doing something wrong or the GReader API doesn't support this and I should try out the Fever API instead?

Yes, no, and no.

(However, using some random old dev version the answer could potentially be "yes, you're using some random dev version that happened to be temporarily broken." Otoh your i=tag:google.com,2005:reader/item/000617fca717eed0 should be correct in combination with a=user/-/state/com.google/read.)

Apologies for the brevity, I only have a couple of minutes.

dbastide commented 1 month ago

Ok, I will try spinning up my own server on the latest version, try again and come back with my findings :)

dbastide commented 1 month ago

So, my findings. I am now running on 1.23.1 on my own server, and I could observe the same behavior. But I could edit the code to investigate :)

It turns out that the params need to be passed as x-www-form-urlencoded image

This is the only way that works. Also the s parameter is not read so no need to pass it.

Frenzie commented 1 month ago

I hadn't noticed that in the screenshot but I have to say that's rather expected. ;-) application/x-www-form-urlencoded is the default for simple things, and multipart form data is for special actions like uploading files. (You could use it for everything but that'd just create unnecessary overhead.)