/search/query response body changes for unknown reason

Hey there!

We’ve built a feature in our website that queries our hosted Discourse forums and displays information about found topics. It was all working nicely last week when we deployed but it stopped over the weekend. It turns out that the topic objects returned from the query have changed structure quite a bit.

Expected response object based on testing during development and also matched the latest docs:

"topics": [
        {
            "id": 1099,
            "title": "Build Error: ipykernel 4.8.2 for python 3.6.6 on Windows",
            "fancy_title": "Build Error: ipykernel 4.8.2 for python 3.6.6 on Windows",
            "slug": "build-error-ipykernel-4-8-2-for-python-3-6-6-on-windows",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2020-06-30T23:36:42.277Z",
            "last_posted_at": "2020-06-30T23:36:42.357Z",
            "bumped": true,
            "bumped_at": "2020-06-30T23:36:42.357Z",
            "archetype": "regular",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "thumbnails": null,
            "tags": [
                "windows",
                "builder"
            ],
            "category_id": 1,
            "has_accepted_answer": false
        }
    ],

Actual/current response:

 "topics": [
        {
            "id": 1494,
            "fancy_title": "Build Error: python-magic 0.4.15 for Python 3.8.2 on Mac",
            "slug": "build-error-python-magic-0-4-15-for-python-3-8-2-on-mac",
            "posts_count": 1,
            "archetype": "regular",
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": [
                "mac",
                "builder"
            ],
            "category_id": 1,
            "has_accepted_answer": false
        }
    ],

I’m wondering if maybe an update was released that changed responses from the search api? Or more likely, if anyone is aware of an admin setting that might cause this?

I had a look through the change log for the last (2.5 released June 24) but don’t see anything that specifically mentions an API change.

Thanks in advance for any assistance.

  • Carey
2 Likes

Yes, the following topic attributes were recently removed from the payload that is returned for search requests:

    image_url
    thumbnails
    title
    created_at
    last_posted_at
    bumped_at
    bumped
    highest_post_number
    reply_count
    unseen

This change was made for performance reasons. You can still get the title with the fancy_title attribute. We will update the docs to reflect this change.

7 Likes

Thanks a lot @simon,

Thanks for the clarification. Thankfully we were already using fancy_title. It was created_at that blew us up.

Oh so that must have been this item in the Release notes; Improve performance of category topic list!

Is there somewhere I can watch for incoming api changes?

Thanks again for the quick assistance.

  • Carey

Sorry, not at the moment, short of the release notes and git changes, but we are certainly thinking about this problem.

1 Like

@th3coop The removal of those fields have been reverted since those fields are considered public API per Discourse API Docs.

3 Likes

Thanks for the heads up, @tgxworld. I’ll admit it was a little disconcerting to have the API suddenly change without warning.

Thanks for the quick resolution!

  • Carey
1 Like