Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mastodon API: deleting a status returns data in non-Mastodon format #5013

Open
VyrCossont opened this issue Mar 22, 2024 · 0 comments
Open

Comments

@VyrCossont
Copy link

An example of the response to fetching an account, in the correct Mastodon format:

{
  "id": "676701638882780286",
  "username": "vyr",
  "acct": "vyr",
  "display_name": "Vyr Cossont",
  "discoverable": true,
  "locked": false,
  "followers_count": 0,
  "following_count": 2,
  "statuses_count": 0,
  "note": "",
  "url": "https://pxlmo.com/vyr",
  "avatar": "https://pxlmo.com/storage/avatars/default.jpg",
  "created_at": "2024-03-22T08:10:43.000000Z",
  "avatar_static": "https://pxlmo.com/storage/avatars/default.jpg",
  "bot": false,
  "emojis": [],
  "fields": [],
  "header": "https://pxlmo.com/storage/headers/missing.png",
  "header_static": "https://pxlmo.com/storage/headers/missing.png",
  "last_status_at": null
}

An example of the response to fetching a status created by the same account, also in the correct format:

{
  "id": "676862453190614440",
  "uri": "https://pxlmo.com/p/vyr/676862453190614440",
  "url": "https://pxlmo.com/p/vyr/676862453190614440",
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "reblog": null,
  "content": "Test post",
  "created_at": "2024-03-22T18:49:44.000Z",
  "emojis": [],
  "reblogs_count": 0,
  "favourites_count": 0,
  "reblogged": false,
  "favourited": false,
  "muted": false,
  "sensitive": false,
  "spoiler_text": "",
  "visibility": "public",
  "application": {
    "name": "web",
    "website": null
  },
  "language": "en",
  "mentions": [],
  "tags": [],
  "poll": null,
  "edited_at": null,
  "account": {
    "id": "676701638882780286",
    "username": "vyr",
    "acct": "vyr",
    "display_name": "Vyr Cossont",
    "discoverable": true,
    "locked": false,
    "followers_count": 0,
    "following_count": 0,
    "statuses_count": 0,
    "note": "",
    "url": "https://pxlmo.com/vyr",
    "avatar": "https://pxlmo.com/storage/avatars/default.jpg",
    "created_at": "2024-03-22T08:10:43.000000Z",
    "avatar_static": "https://pxlmo.com/storage/avatars/default.jpg",
    "bot": false,
    "emojis": [],
    "fields": [],
    "header": "https://pxlmo.com/storage/headers/missing.png",
    "header_static": "https://pxlmo.com/storage/headers/missing.png",
    "last_status_at": null
  },
  "replies_count": 0,
  "media_attachments": [
    {
      "id": "4234093",
      "type": "image",
      "url": "https://assets.pxlmo.com/public/m/_v2/676701638882780286/062ac74bd-fb82c6/6syZhtoc3itU/1VqBRQJAZON4BHRnUa5M43mQKQwpPdT5P2r3PgcZ.jpg",
      "remote_url": null,
      "preview_url": "https://assets.pxlmo.com/public/m/_v2/676701638882780286/062ac74bd-fb82c6/6syZhtoc3itU/1VqBRQJAZON4BHRnUa5M43mQKQwpPdT5P2r3PgcZ_thumb.jpg",
      "text_url": null,
      "meta": {
        "focus": {
          "x": 0,
          "y": 0
        },
        "original": {
          "width": 1280,
          "height": 850,
          "size": "1280x850",
          "aspect": 1.5058823529411764
        }
      },
      "description": null,
      "blurhash": "UBE{%EM_9Px-_JN2W9--IpxtxURjIUxtk8of"
    }
  ],
  "bookmarked": false,
  "card": null
}

An example of the response to deleting a status created by the same account:

{
  "id": "676862453190614440",
  "created_at": "2024-03-22T18:49:44.000000Z",
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "sensitive": false,
  "spoiler_text": "",
  "visibility": "public",
  "language": "en",
  "uri": "https://pxlmo.com/p/vyr/676862453190614440",
  "url": "https://pxlmo.com/p/vyr/676862453190614440",
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "reblogged": false,
  "favourited": false,
  "muted": false,
  "bookmarked": false,
  "reblog": null,
  "application": {
    "name": "web",
    "website": null
  },
  "mentions": [],
  "emojis": [],
  "card": null,
  "poll": null,
  "media_attachments": [
    {
      "id": "4234093",
      "type": "image",
      "url": "https://assets.pxlmo.com/public/m/_v2/676701638882780286/062ac74bd-fb82c6/6syZhtoc3itU/1VqBRQJAZON4BHRnUa5M43mQKQwpPdT5P2r3PgcZ.jpg",
      "remote_url": null,
      "preview_url": "https://assets.pxlmo.com/public/m/_v2/676701638882780286/062ac74bd-fb82c6/6syZhtoc3itU/1VqBRQJAZON4BHRnUa5M43mQKQwpPdT5P2r3PgcZ_thumb.jpg",
      "optimized_url": "https://assets.pxlmo.com/public/m/_v2/676701638882780286/062ac74bd-fb82c6/6syZhtoc3itU/1VqBRQJAZON4BHRnUa5M43mQKQwpPdT5P2r3PgcZ.jpg",
      "text_url": null,
      "meta": {
        "focus": {
          "x": 0,
          "y": 0
        },
        "original": {
          "width": 1280,
          "height": 850,
          "size": "1280x850",
          "aspect": 1.5058823529411764
        }
      },
      "description": null,
      "license": null,
      "is_nsfw": 0,
      "orientation": "landscape",
      "filter_name": null,
      "filter_class": null,
      "mime": "image/jpeg",
      "blurhash": "UBE{%EM_9Px-_JN2W9--IpxtxURjIUxtk8of"
    }
  ],
  "account": {
    "id": "676701638882780286",
    "username": "vyr",
    "acct": "vyr",
    "display_name": "Vyr Cossont",
    "discoverable": true,
    "locked": false,
    "followers_count": 0,
    "following_count": 0,
    "statuses_count": 1,
    "note": "",
    "note_text": null,
    "url": "https://pxlmo.com/vyr",
    "avatar": "https://pxlmo.com/storage/avatars/default.jpg",
    "website": null,
    "local": true,
    "is_admin": false,
    "created_at": "2024-03-22T08:10:43.000000Z",
    "header_bg": null,
    "last_fetched_at": null,
    "pronouns": [],
    "location": null
  },
  "tags": [],
  "text": "Test post"
}

Note that the account object has header_bg instead of header and header_static, is missing emojis and fields, has extra properties like pronouns and location, etc. Same with media_attachments: the object has extra properties not in other Mastodon API responses. I think the response from the delete handler isn't getting the same output transformations applied as other Mastodon API handlers.

The impact is that clients which use the result of a delete call may experience decoding errors.

Additionally, there's no text field on the deleted status as in the Mastodon API, which means that Mastodon API clients can't use this response to do a delete-and-redraft operation, since they don't have the original plain text source of a status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant