Dhruv Parmar

API Support

Facing any issues with the API? Share them here
376 views

Add a comment

Replies

Best
Dhruv Parmar
API Update: We've added support to fetch "makers" & "media" for each Post item. Check out http://api-v2-docs.producthunt.c... cc @ossamaweb @asingh2
JPEGuin
@ossamaweb @asingh2 @dhruvparmar Awesome, is this also reflected in the API explorer?
Dhruv Parmar
@jpeguin1 yes, the API explorer has the new fields.
Sam Ben
@asingh2 @dhruvparmar Awesome! Thanks man ;)
Vasanth
@dhruvparmar Is there a way to upvote using this API? I don't see a mutation for that? Also, what will be the validity for the access_grant_token & access_token?
Dhruv Parmar
@vsnthv Currently we don't allow upvotes via the API. The access_token is long lived(never expires) and access_grant_token expires in 20m.
Dhruv Parmar
API Update: We've added support to fetch "goals" & "goal(id: goalId)" to the API. Check out http://api-v2-docs.producthunt.c... cc @jpeguin1
JPEGuin
@dhruvparmar This is great stuff, thanks!
JPEGuin
@dhruvparmar Seems like doing a "goals" query keeps returning a 204 (no content) for me. It works fine from the API explorer, but any call to this endpoint from my code succeeds but doesn't return anything. Any idea on what may be up with this? EDIT: This has now been resolved on the server-side.
JPEGuin
@dhruvparmar Hi, I've got a quick question about mutations. When attempting to mark a goal as complete, I only get returned {"data":{"goalMarkAsComplete":{"node":null}}} Is this intentional? As it doesn't actually seem to perform the action. Here is my request: mutation { goalMarkAsComplete(input: {clientMutationId: "\(clientId)", goalId: \(goalId)}) { node { id, completedAt, createdAt, title, user { name, id, profileImage, username } } } } And what is the clientMutationId? Is it just a random String or the client ID that's retrieved when authenticating? EDIT: After looking at the error, it's an access_denied error, any way to resolve this?
Dhruv Parmar
@jpeguin1 please write to hello@producthunt.com with your API Key included in the message.
JPEGuin
@producthunt @dhruvparmar Thanks, done it now. Also, I was wondering on when goal creation support will be coming?
Rishi
@dhruvparmar I see some planned updates to APIs here and see recent changes on github. Will the docs be updated asap or do we need to keep an eye here and on github?
Dhruv Parmar
@wayfarerish hey, any updates to the GraphQL interface of the API will always reflect in the reference here http://api-v2-docs.producthunt.c... Unfortunately we don't have a change-log yet so we've decided to publish those updates here as well for the Makers festival participants.
Rishi
@dhruvparmar thank you! :)
Sam Ben
@dhruvparmar Is there a way to know which images are GIFs and which are static from media field?
Dhruv Parmar
@ossamaweb I'm afraid not and we do not plan to expose that information.
Sam Ben
@dhruvparmar Thanks. I'll figure something out. I see that the order of media in the API is different than that on the website. is that bug or website uses some type of sorting?
Knight 
@dhruvparmar hi, still pretty new on this graphql things, but it seem like no way to filter the records ? like if I want to filter all my goals that complete only ? I can only fetch all and filter locally ?
Dhruv Parmar
@imknight hey, you can filter "goals" by using "completed" flag here http://api-v2-docs.producthunt.c... Setting `completed: true` on the query will result in only completed goals being fetched.
Knight 
@dhruvparmar Got it , i use Viewer to check, is a bit funny, when checking own goal cannot filter by using completed flag
Nikolay Siabrenko
@dhruvparmar Hello, how can I get all user following and do not rest against the limit of the API? For example, I want to see what people which I follow do on PH(upvote something, comment, add/finish goal)
Dhruv Parmar
@nikolay_siabrenko you can look up "followers" for a user. check here http://api-v2-docs.producthunt.c... If you run into rate limit issues try fetching "followers" on a per "user" basis. http://api-v2-docs.producthunt.c... We do not support subscriptions as of now, so to get a "user"'s activity you would have to regularly poll for the specific data and detect changes in that on your end. For e.g 1. To detect if a user upvoted a new post, you could poll for "votedPosts" list on the "user" object. 2. To detect changes to user's goal, you can poll "goals(userId: idOfUser)" connection with 'NEWEST' filter.
Nikolay Siabrenko
@dhruvparmar If user have 1000 following, I need make 50 request and it's more than 6250 points. 6250 points it's for all app limit or per auth user?
Dhruv Parmar
@nikolay_siabrenko in cases such as above you'd have to throttle your requests, rate limit quotas reset at every 15m interval.
Amit Chambial
@dhruvparmar Getting the following error during goalCheer mutation. { "data": { "goalCheer": { "node": null, "errors": [ { "message": "access_denied", "field": "base" } ] } } }
Dhruv Parmar
@amitchambial hey, we've just released some fixes to the API. could you retry the same mutation? Incase the issue still persists, please write to us at hello@producthunt.com with your API Key & the input you are using for the mutation.
Vaibhav Singh
@dhruvparmar Hi, I am facing a problem with pagination when I query "posts" ordered by votes , where "hasNextPage" field is always false. My query is { posts (order:VOTES, after:"MjA=") { edges{ node{ id name votesCount } } pageInfo { endCursor hasNextPage } } } For this query "hasNextPage" field is always coming as false. Also the order of nodes I am getting is not exactly in order for instance , this is one of the ouputs where post are not in proper descending order. { "node": { "id": "100183", "name": "Feather Icons", "votesCount": 5118 } }, { "node": { "id": "53552", "name": "Carrd", "votesCount": 4723 } }, { "node": { "id": "52794", "name": "Stripe Atlas (Pre-Launch)", "votesCount": 4890 } }, { "node": { "id": "25535", "name": "Startup Launch List", "votesCount": 4890 } }, { "node": { "id": "108401", "name": "Sublime Text 3.0", "votesCount": 5122 } },
Vaibhav Singh
@dhruvparmar Also what I have noticed that not all the products are present in the output, when I use the UI I can see many other products which are missing from the API output. Example "remove.bg" which should be 3rd in terms of votes is not present in the output but "Startup Pitch Decks" is present at 3rd position. { "node": { "id": "14717", "name": "Startup Stash", "votesCount": 18382 } }, { "node": { "id": "76", "name": "Slack", "votesCount": 14591 } }, { "node": { "id": "75048", "name": "Startup Pitch Decks", "votesCount": 9388 } },
Dhruv Parmar
@vaibhav_soulskill hey, we have an existing issue with pagination. Please add "(first: 20)" to the connection params for now. I'll update here once the issue is fixed.