[deleted] because Flarum uses both a frontend URL builder and a backend URL builder, we haven't implemented a way to get the frontend resource URL from the API.
By creating an extension, you could add an attribute to the backend serializer that's made from the backend URL builder.
The URL can be obtained with
$url->to('forum')->route('discussion', ['id' => $post->discussion_id, 'near' => $post->number]),
$url is an instance of Flarum\Http\UrlGenerator which can be resolved via dependency injection or app(Flarum\Http\UrlGenerator::class)