API is not returning post Name value

AI-generated summary

The API is not returning the post name value, with the name field showing null in the response. Jeremy_D is trying to fetch post details via the API, but it appears that the name field refers to the user’s name, not the post title. Arkshine clarifies that the name field is related to the user’s profile, and that the topic title is not returned in the initial response.

Jeremy_D is actually looking for the topic title, and has found a workaround by fetching a single topic and grabbing the first post in the post_stream. Arkshine explains that post_stream returns the first 20 posts by default, but can be limited using the ?page= query parameter. Additionally, a guide is provided for fetching specific posts. Jeremy_D is using the API to integrate Discourse posts into an Angular application, essentially creating a pseudo-blog.

I’m trying to fetch post details via the api, but it appears the response has null on the name field for all posts I query.

Example trimmed response:

{
    "id": 15,
    "name": null,
    "username": "Jeremy",
    "avatar_template": "/user_avatar/redacted/jeremy/{size}/3_2.png",
    "created_at": "2025-01-28T05:00:56.331Z",
    "cooked": "<p>Placeholder content tbd</p>",
    "post_number": 1,
    "post_type": 1,
    "posts_count": 1,
    "updated_at": "2025-01-28T05:00:56.331Z",

There’s another value that I would think might contain the name of the post, user_title but that is also null. Is there a setting somewhere I’m missing? And yes these posts do in fact have titles.

Hey, welcome to meta!

The name field usually refers to the user’s name. It will be null if no name is defined in your profile (below the username).

Are you looking for the topic title?

Yep, with some extra poking, I was able to decipher how the api (and discourse) is supposed to work hierarchically. So now I’m fetching a single topic and just grabbing the first post in the post_stream.

Does post_stream return all posts on the topic? Or can I limit it in some way?

My use case is that I have an angular application and I’m trying to pull in Discourse posts to essentially make a pseudo-blog that’s integrated into that application. So far this seems entirely doable.

post_stream → posts returns the first 20 posts. You can use ?page= query.
post_stream → streams returns all the topic post IDs.

Additional guide if you want to get specific posts: