Skip to content

Update example response for public JSON petition search API endpoint - #198

Merged
lavaturtle merged 2 commits into
mf-cs-documentationfrom
petitions-search-categories
Oct 20, 2026
Merged

lavaturtle merged 2 commits into
mf-cs-documentationfrom
petitions-search-categories

Conversation

@lavaturtle

Copy link
Copy Markdown

This updates the example response for the /petitions/search endpoint to reflect new fields that have been added as part of the search page redesign:

  • current_page in the meta section
  • categories for each petition
  • activity_score for each petition

While I was here, I went through and checked that this example reflects all the current fields in the JSON. It does, except that we're not showing an example of the image field (which is only included when the petition has an image). So I added an image to one of the petitions in the example response.

@lavaturtle lavaturtle added the merge-candidate This PR is ready to be merged, once it is reviewed and tested label Oct 19, 2026

@woodhull woodhull left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve this docs update.

Separately, and not in a way that disrupts this work, i wanted to wonder outloud if the search endpoint should be cursor paginated, but then I decided that it likely had many fewer pages and was backed by elasticsearch so this perf concern we've been fighting elsewhere in the API is potentially not relevant.

@lavaturtle

Copy link
Copy Markdown
Author

Separately, and not in a way that disrupts this work, i wanted to wonder outloud if the search endpoint should be cursor paginated, but then I decided that it likely had many fewer pages and was backed by elasticsearch so this perf concern we've been fighting elsewhere in the API is potentially not relevant.

Hmm, interesting question! Since search results are sorted by "relevance" rather than id, id-based cursor pagination wouldn't work. But elasticsearch does have some support for pagination -- offset or cursor -- discussed here: https://www.elastic.co/docs/reference/elasticsearch/rest-apis/paginate-search-results

@lavaturtle
lavaturtle merged commit 84fda6d into mf-cs-documentation Oct 20, 2026
2 checks passed
@lavaturtle
lavaturtle deleted the petitions-search-categories branch October 20, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-candidate This PR is ready to be merged, once it is reviewed and tested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants