tumblr / docs

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

How to fetch information about an individual post from a community? #141

Open knuxify opened 2 weeks ago

knuxify commented 2 weeks ago

I can't find a way to fetch information about an individual community post by its ID.

It seems to be possible to get a timeline of posts with GET /v2/communities/{community-handle}/timeline, but that doesn't guarantee I find the post I need. There are /v2/communities/{community-handle}/posts/{post-id}/reaction APIs, but the base /v2/communities/{community-handle}/posts/{post-id} API seems to 404.

Trying to use the regular API for fetching posts (GET /v2/blog/.../posts?id=...) returns 404s. I tried:

None seemed to return the post. Is there something I'm missing?

nightpool commented 2 weeks ago

I think the correct way to do this is to use the communities' @@url with the normal fetch blog post route. so it would be /v2/blog/@@community-handle/posts/id or whatever

On Sun, Nov 10, 2024, 12:34 AM knuxify @.***> wrote:

I can't find a way to fetch information about an individual community post by its ID.

It seems to be possible to get a timeline of posts with GET /v2/communities/{community-handle}/timeline https://github.com/tumblr/docs/blob/master/api.md#get-v2communitiescommunity-handletimeline---get-posts-from-a-community, but that doesn't guarantee I find the post I need. There are /v2/communities/{community-handle}/posts/{post-id}/reaction APIs, but the base /v2/communities/{community-handle}/posts/{post-id} API seems to 404.

Trying to use the regular API for fetching posts (GET /v2/blog/.../posts?id=... https://github.com/tumblr/docs/blob/master/api.md#posts--retrieve-published-posts) returns 404s. I tried:

  • Using the community name as the blog name and the ID from the URL as the ID
  • Using the ID of the community as returned by GET /v2/communities/{community-handle} as the blog name and the ID from the URL as the ID
  • Using the blog name of the poster as the blog name and the ID from the URL as the ID

None seemed to return the post. Is there something I'm missing?

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

marcustyphoon commented 2 weeks ago

Hm, yeah, nope, that doesn't seem to work (though it does on the internal version of the API). Looks like Staff may need to adjust the whitelist for the public API to allow this, unless both you and I are missing something.

knuxify commented 2 weeks ago

/v2/blog/@@community-handle/posts?id also causes a 500 error.

cyle commented 2 weeks ago

yeah, sorry, we haven't done a great job documenting this part yet, because it's still in flux. for now we've been using this route: GET /v2/blogs/@@handle/posts?id=1234 (note the id as query string param instead of path param) that should work for third-party API consumers as well.

so to fetch this post, for example, you'd use GET /v2/blogs/@@communities-feedback/posts?id=766506896898293760

when we've stabilized this, we'll update the docs!

marcustyphoon commented 2 weeks ago

I assume this is a typo for GET /v2/blog/@@handle/posts?id=1234 / GET /v2/blog/@@communities-feedback/posts?id=766506896898293760, at least per redpop? The given endpoint 404s.

If so, does this require oauth? I get a 500 on curl "https://api.tumblr.com/v2/blog/@@communities-feedback/posts?id=766506896898293760&api_key=[removed consumer key]".

cyle commented 2 weeks ago

yeah, it requires a valid OAuth consumer right now, might be restricted to just the official clients right now. the endpoint works for me when using Redpop's API helper in dev console: window.tumblr.apiFetch('/v2/blog/@@communities-feedback/posts?id=766506896898293760')

marcustyphoon commented 2 weeks ago

might be restricted to just the official clients right now

Ah, so it's possible that from an external API standpoint there is currently no way to do this. (I don't have oauth2 login code on me, so I can't verify this for sure at the moment.)