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
v3 API Issues #13819
Comments
For a quick example of this, we can call the "Get challenges for a user" action:
I made this request just now and it returned This data includes
Current I do not have any challenges. That means that all of the challenge data in the response was for "Discover Challenges". I would recommend that "Discover Challenges" should be a separate request. And that separate request should only return what needs to be displayed on the "Discover Challenges" page. Currently, the data returned contains ALL of the challenge data of each challenge. Most of that data should come from a separate request still, for example, the The point that I am trying to make is this, my request to My suggestion, rethink all the endpoints and their actions from the perspective of having them each "Do One Thing And Do It Well". It is far more efficient to have many endpoints with many actions and allow clients to do many small requests, rather than single requests that return massive amounts of data. A single network connection can be reused for multiple requests. I hope that my feedback is helpful. I really love Habitica and have been using it for years. I hope that this feedback can start a deeper conversation about API design. |
This isn't some sort of criticism of the merits of what you've said or anything (particularly not the notification thing, since I can't even think of how that data could in theory be useful for an unrelated request, contrast other parts of the user information like stats which could be useful depending on the action being called), but technically "get all challenges for user" is described in the documentation (here) as doing this:
It also allows you to specify parameters in the query to only return ones where you're a member ( ...Or does it still return all of Discover if you use the query parameters? |
At least some of those notifications will be from this issue: #10752 "notifications for 'Your Invitation has been Accepted' are not shown" For example, SunSparc currently has has 16 notifications in total, of which 9 are
Apart from that issue about the |
@citrusella, you are correct, the @Alys, I am glad to see that one of the problems with the notifications response is being addressed. Keep in mind that my reference to the |
If we want to get specific, 😆 we can look at the "Buy an Enchanted Armoire item" endpoint:
In my opinion the Armoire should have a separate endpoint and not be verb'ed as an action under the {
"type": "food",
"dropKey": "Milk",
"dropArticle": "",
"dropText": "Milk",
"value": 0
} We could debate about whether to put the |
I cannot begin to express how much I agree with this ticket, but the pedant in me feels obligated to point out that many of the potential changes @SunSparc is recommending should probably come with an API version bump. Experience has taught me that, however weird and arcane it may be, there will always be someone relying on the extraneous data in an API response. |
I think they're working on version 4 of the API right now? Maybe? (So maybe this is the perfect time to bring it up? 🤷♀️ ) |
@probaton, I would honestly like to hear all of your reasons for disagreeing with this ticket. @citrusella, from what I can tell, the version 4 of the API has been in the works for a number of years now. It is my expectation that any changes that are made as a result of this ticket would not be applied to the current API version, but to a future version. I agree that right now is a perfect time to make a full audit of the existing API and applying everything learned from that audit into making the next version a significant and welcome upgrade. I also think that future versions of the API should conform to OpenAPI Specifications. |
@SunSparc Not 100% sure, but I'm guessing my perspective was lost in translation when I used negative in my opening statement. The opinion I was going for was "this is an awesome idea, we need this now, it is awesome". The only reason I posted at all (other than to express my support) is that removing response data represents a breaking change, which should come with a version bump. However, it seems that it was either implied or I missed the part where this proposal was intended for v4 of API. As we were apparently already talking about releasing this in a new version I have exactly zero issues with your suggestion and look forward to enjoying a cleaner, faster API. (Also +1 for conforming to OpenAPI.) |
There's information about the API versions and API changes on the wiki at Application Programming Interface but in brief:
|
From another user:
|
@CuriousMagpie what have you finalised for the above issues , do we need to split the apis according to the context ? and integrate it with the frontend |
We're still determining what's the best approach to take here. We're a small team and these things take time. |
Description
From SunSparc in Aspiring Blacksmiths Guild:
I've asked SunSparc for an example of an API call where this happens, so we have a place to start investigating this.
The text was updated successfully, but these errors were encountered: