The Tootfinder REST API
2023-02-26
Tootfinder has a small REST API that allows applications and websites to integrate search results. The API is self documented at the access path
https://www.tootfinder.ch/rest/api/
There is only one path at this time
https://www.tootfinder.ch/rest/api/search/{query}
{query} must be the same string syntax as you use it on the website (see How the full text search works). It is the simple FTS3 Syntax of SQLite (see https://www.sqlite.org/fts3.html) which allows for expressions like
- san franc* https://www.tootfinder.ch/rest/api/search/san+franc*
- san NEAR francisco https://www.tootfinder.ch/rest/api/search/san+NEAR+francisco
- san OR francisco https://www.tootfinder.ch/rest/api/search/san+OR+francisco
- san -francisco https://www.tootfinder.ch/rest/api/search/san+-francisco
The API returns a JSON array of posts in the same format as Mastodon, but with a limited set of fields:
- id:
- created_at
- in_reply_to_id
- in_reply_to_account_id
- sensitivity
- spoiler
- visibility
- language
- uri
- url
- content
- media-attachments
- type
- array of
- preview_url
- url
- description
- card
- type
- title
- description
- url
- image
Note that in_reply_to_id, in_reply_to_account_id will always null, visibility "public" empty, and that there may no media-attachments and no card.
This should be enough elements for the application or the website to create the post as it was a post from a feed from Mastodon.
Update 2023-02-27
There is a second path
https://www.tootfinder.ch/rest/api/activitypub/search/{query}
It wraps the list in a collection.
- @context: "https://www.w3.org/ns/activitystreams"
- summary: "fulltext search returning a collection of statuses"
- type: "Collection"
- totalItems
- items