1
0
mirror of https://github.com/mastodon/documentation synced 2025-04-11 22:56:17 +02:00
documentation/content/en/methods/suggestions.md
Emelia Smith cb3aa4de10
Document new OAuth changes for 4.3.0 (#1445)
* Improve deprecation messaging for Application#vapid_key

* Format JSON examples in Instance methods

* Remove vapid_key from Apps API examples, since this property is deprecated on Application entity

* Add documentation for new OAuth 2.0 features added in 4.3.0

* Improve documentation for oauth-scopes

* Update content/en/api/oauth-scopes.md

Co-authored-by: Matt Jankowski <matt@jankowski.online>

* Update content/en/api/oauth-scopes.md

Co-authored-by: Matt Jankowski <matt@jankowski.online>

* Update content/en/api/oauth-scopes.md

Co-authored-by: Matt Jankowski <matt@jankowski.online>

* Update content/en/api/oauth-scopes.md

Co-authored-by: Matt Jankowski <matt@jankowski.online>

* Add deprecated and removed shortcode labels

* Use deprecated and removed shortcodes

* Improve OAuth documentation

* More OAuth documentation improvements

* Correct streaming API documentation after 4.2.0 changes

* Add note about improved Push Subscription API validation in 4.3.0

* Fix inconsistent OAuth label formatting

* Add note that there is a relationship between Accounts and the Application used to create them

* Add note that application registration endpoint also supports JSON bodies

* Be consistent in the formatting of placeholder values for Bearer tokens

* code review changes

* Slight changes in wording

* Add documentation for PKCE

* Removal of crypto oauth scope

* Cross-link authorization's scope with the OAuth Scopes documentation

* Update content/en/methods/oauth.md

* Update content/en/api/oauth-scopes.md

---------

Co-authored-by: Matt Jankowski <matt@jankowski.online>
Co-authored-by: David Roetzel <david@roetzel.de>
2024-10-10 14:44:19 +02:00

3.9 KiB

title description menu aliases
suggestions API methods Server-generated suggestions on who to follow, based on previous positive interactions.
docs
weight name parent identifier
120 suggestions methods-accounts methods-suggestions
/methods/suggestions
/api/methods/suggestions
/methods/accounts/suggestions

View follow suggestions (v2)

GET /api/v2/suggestions HTTP/1.1

Accounts that are promoted by staff, or that the user has had past positive interactions with, but is not yet following.

Returns: Array of [Suggestion]({{< relref "entities/Suggestion" >}})
OAuth: User token + read
Version history:
3.4.0 - added

Request

Headers
Authorization
{{}} Provide this header with Bearer <user_token> to gain authorized access to this API method.
Query parameters
limit
Integer. Maximum number of results to return. Defaults to 40 accounts. Max 80 accounts.

Response

200: OK
[
  {
    "source": "past_interactions",
    "account": {
      "id": "784058",
      "username": "katie",
      "acct": "katie@pleroma.voidlurker.net",
      // ...
  },
  // ...
  {
    "source": "global",
    "account": {
      "id": "108194863260762493",
      "username": "thunderbird",
      "acct": "thunderbird@mastodon.online",
      // ...
  }
]
401: Unauthorized

Invalid or missing Authorization header.

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

Remove a suggestion

DELETE /api/v1/suggestions/:account_id HTTP/1.1

Remove an account from follow suggestions.

Returns: Empty
OAuth: User token + read
Version history:
2.4.3 - added

Request

Path parameters
:account_id
{{}} String. The ID of the Account in the database.
Headers
Authorization
{{}} Provide this header with Bearer <user_token> to gain authorized access to this API method.

Response

200: OK

A successful call will return an empty object. Note the call will be successful even if the account id provided is invalid or is not a suggested account.

{}
401: Unauthorized

Invalid or missing Authorization header.

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

View follow suggestions (v1) {{%deprecated%}}

GET /api/v1/suggestions HTTP/1.1

Accounts the user has had past positive interactions with, but is not yet following.

Returns: Array of [Account]({{< relref "entities/Account" >}})
OAuth: User token + read
Version history:
2.4.3 - added
3.4.0 - deprecated

Request

Headers
Authorization
{{}} Provide this header with Bearer <user_token> to gain authorized access to this API method.
Query parameters
limit
Integer. Maximum number of results to return. Defaults to 40 accounts. Max 80 accounts.

Response

200: OK
[
  {
    "id": "332766",
    "username": "kaniini",
    "acct": "kaniini@pleroma.site",
    // ...
  },
  {
    "id": "689455",
    "username": "interneteh",
    "acct": "interneteh@sunbeam.city",
    // ...
  },
  {
    "id": "764276",
    "username": "Dee",
    "acct": "Dee@fedi.underscore.world",
    // ...
  },
  // ...
]
401: Unauthorized

Invalid or missing Authorization header.

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

See also

{{< page-relref ref="methods/accounts#follow" caption="POST /api/v1/accounts/:id/follow" >}}

{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v2/suggestions_controller.rb" caption="app/controllers/api/v2/suggestions_controller.rb" >}}

{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/suggestions_controller.rb" caption="app/controllers/api/v1/suggestions_controller.rb" >}}