Dhruv Parmar

API Support

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

Add a comment

Replies

Best
JPEGuin
@dhruvparmar Hey, I've got a quick question regarding the API - So a simple body param to fetch posts would look like "query": "query { posts(first: 1) { edges { node { id, name } } } }", but what would one for fetching something more nested like the posts in a collection look like? And in general where can I find this documented? EDIT: I've now figured it out. For anyone curious: Start with "collection(id: idOfTheCollection) {... which should return all posts in the collection.
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.