tumblr / docs

Tumblr's public platform documentation.
Apache License 2.0
109 stars 27 forks source link

Something fishy with for /user/follow - fails but with HTTP 200 #44

Closed sorin-costea closed 3 years ago

sorin-costea commented 3 years ago

When calling /user/follow with some okay blog (not sensitive, very public, everything normal) I get the following response:

{
  "meta": {
    "status": 200,
    "msg": "OK"
  },
  "response": {
    "blog": {
      "ask": true,
      "ask_anon": true,
      "ask_page_title": "...",
      "asks_allow_media": true,
      "avatar": [
        {...}
      ],
      "can_chat": true,
      "can_send_fan_mail": false,
      "can_subscribe": false,
      "description": "...",
      "followed": false,
      "is_blocked_from_primary": false,
      "is_nsfw": false,
      "likes": 2880,
      "name": "...",
      "posts": 26783,
      "share_likes": true,
      "subscribed": false,
      "theme": {...},
      "title": "...",
      "total_posts": 26783,
      "updated": 1615809420,
      "url": "https://....tumblr.com/",
      "uuid": "t:..."
    }
  }
}

Notice? It says followed=false. So the operation actually failed even though it answered 200. The headers look okay as well:

X-Ratelimit-Perhour-Remaining=980
X-Ratelimit-Perhour-Reset=3343
X-Ratelimit-Perhour-Limit=1000
X-Ratelimit-Perday-Remaining=4893
X-Ratelimit-Perday-Reset=81297
X-Ratelimit-Perday-Limit=5000

so... there must be something wrong in the documentation some place...

cyle commented 3 years ago

Notice? It says followed=false.

This is most likely just a race condition on our side, i.e. the record being saved to indicate you now follow that blog is written a microsecond after we query to see if you're following that blog when we render that JSON. We can fix it on our side. 👍 Thanks for bringing it to our attention!

sorin-costea commented 3 years ago

I'm totally happy to help getting Tumblr better :) but unfortunately that user is still not followed even now after a day (just checked on my dash), so there must be more to it - the query happened like you said, yet the operation still failed for some hidden reason.

sorin-costea commented 3 years ago

@cyle could it rather be the 200 follows/day quota being applied?

cyle commented 3 years ago

@cyle could it rather be the 200 follows/day quota being applied?

This is possible, though the Tumblr API should be throwing a 4xx status code (most likely 403 Forbidden) at you in that case, not a 200 OK. I'll update this with more info when we've figured it out. 👌

cyle commented 3 years ago

Sorry for not getting to this much sooner -- the issue should be resolved now, followed should be true in the response after a successful follow.