Search code examples
mastodon

Mastodon API remote boost what's the :id?


I would like to write a Chrome extension which makes boosting toots on another instance more seamless.

I am looking at https://docs.joinmastodon.org/methods/statuses/#boost

It says POST /api/v1/statuses/:id/reblog

About :id it says "The ID of the Status in the database."

How do I find this for a remote toot?


Solution

  • Use the search API to locate the status based on its URL, like this:

    GET endpoint/api/v2/search?resolve=true&q=https://endpoint/status_url
    

    If the URL is valid, you will have an item inside statuses object and you can pick its id from there. Path would be statuses[0].id, but ensure statuses length is greater than 0 to confirm the URL is valid.

    Use that ID to make the request to the boost method.