tumblr / docs

Tumblr's public platform documentation.
Apache License 2.0
108 stars 26 forks source link

Avatar URL not returned in /notes endpoint #107

Closed suleymangezsat closed 1 year ago

suleymangezsat commented 1 year ago

Currently, when I make a request to retrieve notes, the response does not include the avatar URL for any of the notes.

I would like to know if I need to change the request to get this information or if the current API version just doesn't provide it at all.

Example request: https://api.tumblr.com/v2/blog/{blog-identifier}/notes?id={post-id}&mode=all Response:

{
  "meta": {
    "status": 200,
    "msg": "OK"
  },
  "response": {
    "notes": [
      {
        "type": "like",
        "timestamp": 1620593131,
        "blog_name": "blog1",
        "blog_uuid": "t:ABCDEF12345",
        "blog_url": "https://blog1.tumblr.com/",
        "followed": false,
        "avatar_shape": "circle"
      },
      {
        "type": "reblog",
        "timestamp": 1620592889,
        "blog_name": "blog2",
        "blog_uuid": "t:GHIJKL56789",
        "blog_url": "https://blog2.tumblr.com/",
        "followed": false,
        "avatar_shape": "square",
        "post_id": "987654321",
        "reblog_parent_blog_name": "blog3"
      }
    ]
  }
}
cyle commented 1 year ago

The current API accidentally only includes that information for our Official Tumblr apps, but there's no reason it can't be updated to include this info for you and other third-party consumers. Just an oversight on our part! I'll see what I can do here.

nightpool commented 1 year ago

alternatively, you can always use the static avatar route to always get a url for the users avatar. https://api.tumblr.com/v2/blog//avatar will always redirect to the user's most recent avatar, and it works without authentication/in an img tag, etc. I believe it takes a size parameter as well.

On Tue, May 9, 2023, 4:01 PM cyle gage @.***> wrote:

The current API accidentally only includes that information for our Official Tumblr apps, but there's no reason it can't be updated to include this info for you and other third-party consumers. Just an oversight on our part! I'll see what I can do here.

— Reply to this email directly, view it on GitHub https://github.com/tumblr/docs/issues/107#issuecomment-1540885095, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABZCVZ2BHJS3KE4PUOIOMDXFKWDZANCNFSM6AAAAAAX32H6MQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

suleymangezsat commented 1 year ago

@cyle Thank you for your response and for looking into the issue. It would be helpful to return it in note objects. I look forward to hearing about any updates.

@nightpool I would prefer to get this information from the note object without extra redirection. Also, I guess the size feature is not working. Even though I give the size 30, it returns a 64x64 image. Or am I doing something wrong? Example request: https://api.tumblr.com/v2/blog/${note.blog_uuid}/avatar/30

nightpool commented 1 year ago

The size feature can only choose between the precomputed sizes Tumblr makes available.

Out of curiosity—what use case do you have that makes the redirection harder to use? Every HTTP library I'm aware of should handle the redirection automatically without you doing any extra work.

On Tue, May 9, 2023, 4:31 PM suleymangezsat @.***> wrote:

@cyle https://github.com/cyle Thank you for your response and for looking into the issue. It would be helpful to return it in note objects. I look forward to hearing about any updates.

@nightpool https://github.com/nightpool I would prefer to get this information from the note object without extra redirection. Also, I guess the size feature is not working. Even though I give the size 30, it returns a 64x64 image. Or am I doing something wrong? Example request: https://api.tumblr.com/v2/blog/${note.blog_uuid}/avatar/30

— Reply to this email directly, view it on GitHub https://github.com/tumblr/docs/issues/107#issuecomment-1540919009, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABZCV5F6FAK5SWWGPIW2DLXFKZS3ANCNFSM6AAAAAAX32H6MQ . You are receiving this because you were mentioned.Message ID: @.***>

suleymangezsat commented 1 year ago

@nightpool I sent the size as 30, specified as precomputed in the API documentation.

Regarding redirection, while it's true that most HTTP libraries handle it automatically, I wanted to avoid unnecessary requests and potential performance issues. Additionally, it would be more convenient to have the avatar URL directly available in the note object, especially when dealing with a large number of notes.

cyle commented 1 year ago

The avatar_url object is now included in the response, and it has two fields: 64 and 128, which are the two avatar size classes. Each value is that avatar size's URL.