API to get composer settings?

AI-generated summary

Chrisbai2021 asks if there’s an API to retrieve composer settings, such as minimum post length, for a mobile app to enforce client-side validation. They note that while admin/site_settings/category/posting.json exists, it’s restricted to admins. Pfaffman suggests reverse-engineering the Discourse API or inspecting the composer’s source code, noting that the client doesn’t appear to fetch these limits and instead checks them on submission. Chrisbai2021 Chrisbai2021 pfaffman

Hello friends,

I am building a mobile forum app using Discourse API and I’d like to implement client-side minimum character enforcement for topics/posts so that we don’t have to fire an API request to validate whether the inputted text content satisfy the requirements.

However it does look like we allow configuring minimum post and first post length dynamically through admin settings.

My question is: is there a way to fetch down all these settings using an API call (in my case, at app startup time) so that the app doesn’t need to hardcode the thresholds and assume they won’t change?

Thanks in advance for taking a look!

Best,
Chris

I found admin/site_settings/category/posting.json but it seems that this is only visible to admin users…

Best I can offer is to Reverse engineer the Discourse API and see if the UX is pulling down the information that you require.

I didn’t see in a quick look, so the next thing I’d do is look in the source of the composer.

And a quick look at max_post_length I don’t see it in a serializer, so I think that the Discourse client probably just posts it to see if it’s too long. And then I tested that, and indeed, the client doesn’t know the max length: