Execute a request against the Mastodon API. For successful requests, the HTTPResponse object will contain an object or array or objects decoded from the JSON returned by Mastodon as appropriate to the request made. Refer to Mastodon API documentation for details about the expected parameters and responses. Drafts will handle wrapping the request in the appropriate OAuth authentication flow.
Optionaldata?: { [x: string]: string }An object containing data to be encoded into the HTTP body of the request..
Optionalheaders?: { [x: string]: string }An object contain key-values to be added as custom headers in the request. There is no need to provide authorization headers, Drafts will add those.
The HTTP method, like "GET", "POST", etc.
Optionalparameters?: { [x: string]: string }An object containing key-values to be added to the request as URL parameters. Drafts will take care of encoding these.
The path to the API endpoint in the Mastodon API. This should include the entire path, including api version, usually something like /api/v1/statuses This will be combined with the host used by the Mastodon instance making the call to build a complete URL.
Post a status update to a Mastodon account. Returns true if successful, false if not. After success the lastResponse object can be used to inspect response and get details such as the ID of the post created. Refer to Mastodon API POST /statuses documentation for response details.
Content for the status update
OptionalcontentWarning: stringOptional short string to use as the content warning (aka "spoiler text") for the post.
Optionalvisibility: mastodonVisibilityThe visibility status of the post, default "public"
OptionalisSensitive: booleanIf true, the post will be marked as containing sensitive content.
StaticcreateCreates a new Mastodon object. Host parameter should be specified as the domain name of the instance you wish to target (i.e. mastodon.social), not a full URL. Identifier is optional but recommend if you work with more than one Mastodon account.
The domain name of the Mastodon instance to use. Use only the host name, not the full URL, i.e. mastodon.social.
Optional, but recommended, credential identifier for the account. This appears for identification purposes in Drafts Settings > Credentials and should be unique for each Mastodon account. We recommend using @username to help with identification.
Script integration with Mastodon. The
updateStatusmethod is a convenience method for posting a status update, but the entire Mastodon API can be used with the request method, which handles OAuth authentication and authorization to Mastodon hosts.Example
Post Status
Retreive Bookmarks