Support for tl=[lang] parameters in REST API (for non-anon users)

In our use case, we are trying to GET localized posts from closed categories in our forum.

It would be a neat addition for the REST API to support ?tl=en as a parameter to pull the translated version of the cooked post.

Currently, the tl param only works for anons.

2개의 좋아요

In general, if you want to find out about the API, the fastest way is to Reverse engineer the Discourse API

1개의 좋아요

This already works for me, for example the current topic with .json?tl=fr gives the right response, notice that cooked is in French:

A post was split to a new topic: Tl=lang crawler view not showing posts in lang

I tried exactly that via /posts/id.json endpoint, but get just the original version in cooked.

Could you check on your end? https://meta.discourse.org/posts/1887991.json?tl=fr

That endpoint works for me, it returns cooked in French. If I switch to tl=es, it returns cooked in Spanish.

Are you calling these endpoints from a specific user? On my end, I am making the requests anonymously.

yep, I do them while logged in. And that’s actually what I am trying to achieve since I want to be able to GET posts from closed categories in our forum.

1개의 좋아요

The tl param only works for anons.

3개의 좋아요

Thx for the confirmation! I will edit first post into a feauture request then