producthunt / producthunt-api

Product Hunt API
311 stars 28 forks source link

API use #115

Closed TiagoApostolo closed 7 years ago

TiagoApostolo commented 7 years ago

Hi! I need to use the api to an iOS app, to show the posts. I didn't understand how can I get access to it. Need some help.

andreasklinger commented 7 years ago

@TiagoApostolo http://api.producthunt.com/v1/docs should be a good starter let me know if you have more questions

TiagoApostolo commented 7 years ago

andreasklinger, thanks but I didn't get how can I have an access token. I have this: {"error":"unauthorized_oauth","error_description":"Please supply a valid access token. Refer to our api documentation about how to authorize an api request. Please also make sure you require the correct scopes. Eg \"private public\" for to access private endpoints."}'

I only need it to a simple app to school.. :)

andreasklinger commented 7 years ago

go here: https://www.producthunt.com/v1/oauth/applications

create an app and a developer token

pick any endpoint from here: http://api.producthunt.com/v1/docs

eg

https://api.producthunt.com/v1/posts/all?search[url]=https://blokdust.com this will show you all posts that relate to the url https://blokdust.com

be sure to include these headers:

Accept: application/json
Content-Type: application/json
Authorization: Bearer <your developer token from before

now you can create a simple html page with a form asking for an URL to check you server just needs to ping our API and see if there is a response (show the link) or not

andreasklinger commented 7 years ago

if you have more questions feel free to reopen

TiagoApostolo commented 7 years ago

@andreasklinger It is a iOS app, so what should be the redirect URL in "create a application"?

shadowTech827 commented 7 years ago

Getting the same issue even after providing the developer token in Authorization header