docs icon indicating copy to clipboard operation
docs copied to clipboard

Notifications documentation doesn't seem to match reality

Open sorin-costea opened this issue 3 years ago • 6 comments

When looking at the /notifications endpoint documentation:

  • it gives for the types parameter a String[] type, but how does an array look for a query parameter??? Any URL example please?
  • Anything I send there seems to have zero effect on the response, I always receive all notification types. I tried with types=[like] and types=like and types=[like,reply] and types=like,reply so because of point above I can't tell whether it's my fault or filtering is simply not working.
  • it mentions the _links response object however that object is never returned. Do I need to send an undocumented query parameter to get it?
  • I could have tried more variants but it's a hassle as the API console doesn't support this endpoint, so here I am asking you :) thank you!

sorin-costea avatar Mar 12 '21 14:03 sorin-costea

the way the official web client does it is /notifications?types[0]=like&types[1]=reply to filter to likes and replies

AprilSylph avatar Mar 12 '21 15:03 AprilSylph

as far as i can see, an array for a query parameter should look like your fourth example:

const parameters = new URLSearchParams();
parameters.set('types', ['like', 'reply']);
console.log(parameters.toString()); // "types=like%2Creply"

so assuming you're encoding the comma correctly as above, the documentation really needs to specify the API's nonstandard array parameter format

AprilSylph avatar Mar 12 '21 15:03 AprilSylph

I can confirm /notifications?types[0]=like&types[1]=reply is working, although the return types aren't always from the types list :) (hello reblog_with_content)

As for the [] format, I tried with types=reply and it did no filtering, so comma can't be the culprit. It's just a weird serialization.

sorin-costea avatar Mar 12 '21 15:03 sorin-costea

So in case somebody needs the Java client, my Jumblr fork retrieves now the notifications feed. I didn't bother with a pull request as the original client project is abandoned.

sorin-costea avatar Mar 12 '21 16:03 sorin-costea

Thanks for this feedback -- we'll update the API docs with examples to help clarify this! 👌

cyle avatar Mar 12 '21 17:03 cyle

Maybe you can also mention the developers that requesting reblog_with_content type, will return reblog type notes...

sorin-costea avatar Mar 12 '21 17:03 sorin-costea