producthunt / producthunt-api

Product Hunt API
311 stars 28 forks source link

Get arbitrary product by name or PH URL #117

Closed pointum closed 7 years ago

pointum commented 7 years ago

Looks like there’s no way to get an arbitrary product ID by name or Product Hunt URL. I wish there was something like /v1/posts/all?search[name] or /v1/posts/all?search[discussion_url] so that a user could search through products by name or pick a product by dropping https://www.producthunt.com/posts/XXX url into my app. I don’t want to scrap or cache all posts just to get relevant product IDs. The point of the app is to bookmark posts and get notified of new comments. You don’t provide this useful feature on the website. At this point my app can track my own products through /v1/me/, but I wanted to make the app useful for non-makers as well.

mscoutermarsh commented 7 years ago

Hey,

You can retrieve them by slug (the url safe name of the product).

Example: https://api.producthunt.com/v1/posts/all?search[slug]=meerkat

Will grab: https://www.producthunt.com/posts/meerkat

Hope that helps 😄

pointum commented 7 years ago

Perfect! Thank you. I don't think [slug] is ever mentioned in the docs for posts.

mscoutermarsh commented 7 years ago

🙌