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

notifications

Receive notifications for activity on your account or statuses.

get
Get all notifications

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

Notifications concerning the user. This API returns Link headers containing links to the next/previous page. However, the links can also be constructed dynamically using query params and id values.

戻り値: Array of Notification
OAuth: User token + read:notifications
実装履歴:

  • 0.0.0 - 追加
  • 2.6.0 - add min_id
  • 2.9.0 - add account_id

リクエスト

ヘッダ
Authorization
必須
string
Bearer <user token>
クエリ
max_id
任意
string
Return results older than this ID
since_id
任意
string
Return results newer than this ID
min_id
任意
string
Return results immediately newer than this ID
limit
任意
string
Maximum number of results to return (default 20)
exclude_types
任意
array
Array of types to exclude (follow, favourite, reblog, mention, poll)
account_id
任意
string
Return only notifications received from this account

レスポンス

200: Success

Sample call with limit=2. Use the Link header for pagination

Link: <https://mastodon.social/api/v1/notifications?max_id=34975535>; rel="next", <https://mastodon.social/api/v1/notifications?min_id=34975861>;

[
  {
    "id": "34975861",
    "type": "mention",
    "created_at": "2019-11-23T07:49:02.064Z",
    "account": {
      "id": "971724",
      "username": "zsc",
      "acct": "zsc",
      ...
    },
    "status": {
      "id": "103186126728896492",
      "created_at": "2019-11-23T07:49:01.940Z",
      "in_reply_to_id": "103186038209478945",
      "in_reply_to_account_id": "14715",
      ...
      "content": "<p><span class=\"h-card\"><a href=\"https://mastodon.social/@trwnh\" class=\"u-url mention\">@<span>trwnh</span></a></span> sup!</p>",
      ...
      "account": {
        "id": "971724",
        "username": "zsc",
        "acct": "zsc",
        ...
      },
      ...
      "mentions": [
        {
          "id": "14715",
          "username": "trwnh",
          "url": "https://mastodon.social/@trwnh",
          "acct": "trwnh"
        }
      ],
      ...
    }
  },
  {
    "id": "34975535",
    "type": "favourite",
    "created_at": "2019-11-23T07:29:18.903Z",
    "account": {
      "id": "297420",
      "username": "haskal",
      "acct": "haskal@cybre.space",
      ...
    },
    "status": {
      "id": "103186046267791694",
      "created_at": "2019-11-23T07:28:34.210Z",
      "in_reply_to_id": "103186044372624124",
      "in_reply_to_account_id": "297420",
      ...
      "account": {
        "id": "14715",
        "username": "trwnh",
        "acct": "trwnh",
        ...
      }
    }
  }
]

401: Unauthorized

Invalid or missing Authorization header

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

get
Get a single notification

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

View information about a notification with a given ID.

戻り値: Notification
OAuth: User token + read:notifications
実装履歴:

  • 0.0.0 - 追加

リクエスト

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

レスポンス

200: Success

A single Notification

{
  "id": "34975861",
  "type": "mention",
  "created_at": "2019-11-23T07:49:02.064Z",
  "account": {
    "id": "971724",
    "username": "zsc",
    "acct": "zsc",
    ...
  },
  "status": {
    "id": "103186126728896492",
    "created_at": "2019-11-23T07:49:01.940Z",
    "in_reply_to_id": "103186038209478945",
    "in_reply_to_account_id": "14715",
    ...
    "content": "<p><span class=\"h-card\"><a href=\"https://mastodon.social/@trwnh\" class=\"u-url mention\">@<span>trwnh</span></a></span> sup!</p>",
    ...
    "account": {
      "id": "971724",
      "username": "zsc",
      "acct": "zsc",
      ...
    },
    ...
    "mentions": [
      {
        "id": "14715",
        "username": "trwnh",
        "url": "https://mastodon.social/@trwnh",
        "acct": "trwnh"
      }
    ],
    ...
  }
},

401: Unauthorized

Invalid or missing Authorization header

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

post
Dismiss all notifications

https://mastodon.example/api/v1/notifications/clear

Clear all notifications from the server.

戻り値: empty object
OAuth: User token + write:notifications
実装履歴:

  • 0.0.0 - 追加

リクエスト

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

レスポンス

200: Success

Notifications successfully cleared

{}

401: Unauthorized

Invalid or missing Authorization header

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

post
Dismiss a single notification

https://mastodon.example/api/v1/notifications/:id/dismiss

Clear a single notification from the server.

戻り値: empty object
OAuth: User token + write:notifications
実装履歴:

  • 1.3.0 - 追加

リクエスト

パス
:id
必須
string
ID of the notification to be cleared
ヘッダ
Authorization
必須
string
Bearer <user token>

レスポンス

200: Success

Notification with given ID successfully dismissed

{}

401: Unauthorized

Invalid or missing Authorization header

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

post
\(DEPRECATED\) Dismiss a single notification

https://mastodon.example/api/v1/notifications/dismiss

Delete a single notification from the server.

戻り値: empty object
OAuth: User token + write:notifications
Version history:

  • 0.0.0 - available
  • 3.0.0 - removed

リクエスト

ヘッダ
Authorization
必須
string
Bearer <user token>
フォームのパラメータ
id
必須
string
ID of the notification to be cleared, passed as a parameter

レスポンス

200: Success

Notification with given ID successfully dismissed

{}

401: Unauthorized

Invalid or missing Authorization header

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

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

Merch

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

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

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