Mastodon
  • Mastodonの使い方
    • Signing up for an account
    • Setting up your profile
    • Posting toots
    • Using the network features
    • Dealing with unwanted content
    • Promoting yourself and others
    • Set your preferences
    • その他の設定
    • Using Mastodon externally
    • Moving or leaving accounts
  • Mastodonの構築
    • マシンの準備
    • ソースからインストール
    • 環境設定
    • オプションのインストール
      • 全文検索
      • 秘匿サービス
      • シングルサインオン
    • セットアップを完了する
    • 開発者向けコマンドラインを利用する
    • 新しいバージョンへアップグレード
    • サーバのバックアップ
    • 新しいマシンへの移行
    • サーバーのスケールアップ
    • モデレーション
    • トラブルシューティング
  • アプリケーションの開発
    • Getting started with the API
    • Playing with public data
    • Obtaining client app access
    • ログイン
    • ガイドラインとベストプラクティス
    • ライブラリ等
  • コントリビューション
    • 技術的情報
    • 開発環境のセットアップ
    • ソースコードの構造
    • ルーティング
  • スペック
    • ActivityPub
    • WebFinger
    • Security
    • Microformats
    • OAuth
  • REST API
    • OAuthスコープ
  • API一覧
    • apps
      • oauth
    • accounts
      • bookmarks
      • favourites
      • mutes
      • blocks
      • domain_blocks
      • filters
      • reports
      • follow_requests
      • endorsements
      • featured_tags
      • preferences
      • suggestions
    • statuses
      • media
      • polls
      • scheduled_statuses
      • streaming
    • timelines
      • conversations
      • lists
      • markers
    • notifications
      • push
    • search
    • instance
      • trends
      • directory
      • custom_emojis
    • admin
    • proofs
    • oembed
  • APIエンティティ
    • Account
    • Activity
    • Admin::Account
    • Admin::Report
    • Application
    • Attachment
    • Card
    • Context
    • Conversation
    • Emoji
    • Error
    • FeaturedTag
    • Field
    • Filter
    • History
    • IdentityProof
    • Instance
    • List
    • Marker
    • Mention
    • Notification
    • Poll
    • Preferences
    • PushSubscription
    • Relationship
    • Report
    • Results
    • ScheduledStatus
    • Source
    • Status
    • Tag
    • Token

filters

フィルターの追加と管理

get
View all filters

https://mastodon.example/api/v1/filters

戻り値: Filter
OAuth: User token + read:filters
実装履歴:

  • 2.4.3 - 追加

リクエスト

ヘッダ
Authorization
必須
string
Bearer <user token>

レスポンス

200: Success

Excerpts of various filters in different contexts.

[
  {
    "id": "6191",
    "phrase": ":eurovision2019:",
    "context": [
      "home"
    ],
    "whole_word": true,
    "expires_at": "2019-05-21T13:47:31.333Z",
    "irreversible": false
  },
  ...
  {
    "id": "5580",
    "phrase": "@twitter.com",
    "context": [
      "home",
      "notifications",
      "public",
      "thread"
    ],
    "whole_word": false,
    "expires_at": null,
    "irreversible": true
  },
  ...
]

401: Unauthorized

Invalid or missing Authorization header

{
  "error": "The access token is invalid"
}

get
View a single filter

https://mastodon.example/api/v1/filters/:id

戻り値: Filter
OAuth: User token + read:filters
実装履歴:

  • 2.4.3 - 追加

リクエスト

パス
:id
必須
string
ヘッダ
Authorization
必須
string
Bearer <user token>

レスポンス

200: Success

Filter returned successfully

{
  "id": "8449",
  "phrase": "test",
  "context": [
    "home",
    "notifications",
    "public",
    "thread"
  ],
  "whole_word": false,
  "expires_at": "2019-11-26T09:08:06.254Z",
  "irreversible": true
}

401: Unauthorized

Invalid or missing Authorization header

{
  "error": "The access token is invalid"
}

404: Not Found

Filter ID does not exist, or is not owned by you

{
  "error": "Record not found"
}

post
Create a filter

https://mastodon.example/api/v1/filters

戻り値: Filter
OAuth: User token + write:filters
実装履歴:

  • 2.4.3 - 追加

リクエスト

ヘッダ
Authorization
必須
string
Bearer <user token>
フォームのパラメータ
phrase
必須
string
Text to be filtered
context
必須
array
Array of enumerable strings home, notifications, public, thread. At least one context must be specified.
irreversible
任意
boolean
Should the server irreversibly drop matching entities from home and notifications?
whole_word
任意
boolean
Consider word boundaries?
expires_in
任意
string
ISO 8601 Datetime for when the filter expires. Otherwise, null for a filter that doesn’t expire.

レスポンス

200: Success

The newly-created filter will be returned.

{
  "id": "8449",
  "phrase": "test",
  "context": [
    "home",
    "notifications",
    "public",
    "thread"
  ],
  "whole_word": false,
  "expires_at": "2019-11-26T09:08:06.254Z",
  "irreversible": true
}

401: Unauthorized

Invalid or missing Authorization header

{
  "error": "The access token is invalid"
}

422: Unprocessable Entity

If phrase or context are not provided properly

phrase

{
  "error": "Validation failed: Phrase can't be blank"
}
context
{
  "error": "Validation failed: Context can't be blank, Context None or invalid context supplied"
}

put
Update a filter

https://mastodon.example/api/v1/filters/:id

戻り値: Filter
OAuth: User token + write:filters
実装履歴:

  • 2.4.3 - 追加

リクエスト

パス
id
必須
string
ID of the filter in the database
ヘッダ
Authorization
必須
string
Bearer <user token>
フォームのパラメータ
phrase
必須
string
Text to be filtered
context
必須
array
Array of enumerable strings home, notifications, public, thread. At least one context must be specified.
irreversible
任意
boolean
Should the server irreversibly drop matching entities from home and notifications?
whole_word
任意
boolean
Consider word boundaries?
expires_in
任意
string
ISO 8601 Datetime for when the filter expires. Otherwise, null for a filter that doesn’t expire.

レスポンス

200: Success

Filter updated successfully

{
  "id": "8449",
  "phrase": "test",
  "context": [
    "home",
    "notifications",
    "public",
    "thread"
  ],
  "whole_word": false,
  "expires_at": null,
  "irreversible": true
}

401: Unauthorized

Invalid or missing Authorization header

{
  "error": "The access token is invalid"
}

404: Not Found

The filter does not exist or is not owned by you

{
  "error": "Record not found"
}

422: Unprocessable Entity

If phrase or context are not provided properly

phrase

{
  "error": "Validation failed: Phrase can't be blank"
}
context
{
  "error": "Validation failed: Context can't be blank, Context None or invalid context supplied"
}

delete
Remove a filter

https://mastodon.example/api/v1/filters/:id

戻り値: Filter
OAuth: User token + write:filters
実装履歴:

  • 2.4.3 - 追加

リクエスト

パス
id
必須
string
ID of the filter in the database
ヘッダ
Authorization
必須
string
Bearer <user token>

レスポンス

200: Success

The filter has been deleted successfully, so an empty object will be returned.

{}

401: Unauthorized

Invalid or missing Authorization header

{
  "error": "The access token is invalid"
}

404: Not Found

The filter does not exist or is not owned by you

{
  "error": "Record not found"
}

最終更新 July 1, 2020 · このページを改善する
他の言語: English

Merch

Tシャツとステッカー(英語)

Mastodonに参加しよう · ブログ · ·

ソースコード · CC BY-SA 4.0 · インプリント