Is there a way to modify Discourse endpoints through plugin?

for example, I want to change the result on /latest.json endpoint,
and I found the controller is list_controller.rb,
is there a way to modify related functions through plugin?

There’s almost nothing a plugin can’t do. The question is generally more: is it a good idea ? is it maintainable?

What have you tried so far ?

A good starting point it to look at our all-the-plugins repo and search for similar patterns.

2 Likes

It’s best to look at an example, I believe you can amend the serialisers:

Consider this:

With, for example, the Topic List Previews Plugin edits, from here:

This appends a load of extra attributes. Try it and take a look.

4 Likes

ok, thank you so much!

1 Like