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

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

Open
knuxify opened this issue Nov 10, 2024 · 7 comments
Open

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

knuxify opened this issue Nov 10, 2024 · 7 comments

Comments

@knuxify
Copy link

knuxify commented Nov 10, 2024

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:

  • 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 (causes internal server error/500)
  • 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?

@nightpool
Copy link

nightpool commented Nov 10, 2024 via email

@marcustyphoon
Copy link
Contributor

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
Copy link
Author

knuxify commented Nov 10, 2024

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

@cyle
Copy link
Member

cyle commented Nov 11, 2024

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
Copy link
Contributor

marcustyphoon commented Nov 11, 2024

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
Copy link
Member

cyle commented Nov 11, 2024

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
Copy link
Contributor

marcustyphoon commented Nov 11, 2024

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.)

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

4 participants