-
Notifications
You must be signed in to change notification settings - Fork 1
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
REST API Specifications #19
Comments
Looking good 👍 For the Comparisons:
By using a single endpoint we'd have less code to maintain, less tests, less in our open api spec, less overhead for API consumers since we have 1 Currently, I can't think of a time where I'd prefer to use a specialised
Why is |
Interesting point, I think that having primary query params composing the URL and secondary ones as params can make API easer to understand. However you made me realize that
My mistake, it's not required. Updated the text to make clear. |
Yep this is sounding good, for this part:
Would we still be able to provide
IMO For these:
I'm not sure I see a need for both hashed & non-hashed endpoints, when would I use one over the other? |
Could't think any use case for that, but don't hurts having it as a possibility.
You are right.
@pragmaxim is going to index hashes to help on secondary indexes so we thought "why not"? But I agree with you, that has really marginal use cases, and we should probably transform them into URL query params. |
Sorry if I'm being a bit pedantic on these - I've worked on APIs that have a heap of endpoints that were very similar and it makes it hard for API consumers to use our API and harder for us to maintain What I was basically getting at was maybe we just drop non-hashed endpoints and keep the hash ones - if users have contract/template hashes they're good to go, if not they run them through a hashing func first but URL query params could also work |
Updated:
|
Don't worry, your input is being really helpful.
Hmm, probably best to keep non-hashed endpoints as it is more straight forward and it's what devs are used to do (at least for contracts), hashed endpoints requires one more step from clients. |
Having another look I think I still lean towards having a base
Whereas:
Is clear that it's returning a If you get my drift 🏄 |
Yeah, you have a solid point, I'm with you. Let's wait for @pragmaxim's feedback so we can do all changes at once. |
Thanks guys, regarding the debate whether path-based or query based endpoints, imho that is just implementation detail. We should look at the API such that user is aware of the 1:M relationship between address and boxes, so it returns either a detail or aggregations of the first path element :
That would sort of work, I'm worried more about how to decide on return type, ie. give me only box ids for given address :
As sometimes it can be even tens of thousands of boxes for an address. So overall, I have a feeling that WHAT could be decided by path-based style and HOW could be decided by query-based style. |
I'm happy with both approaches, I like @ross-weir's suggestion more because it will potentially lead to less code/tests to maintain. But no hard feelings.
Cherry picking returning properties and checking for the existence of a resource can be very useful for some cases. My suggestion:
|
Uff, this is exactly something that one can do in Javascript, but grow a neckbeard doing in Scala... Having any kind of dynamic dictionary or something like that in Scala is a nightmare. You can imagine the Scala land as typesafe mapping of database entities .... That's why the whole idea with Query is really hard for me implement. This is something that should be done by GraphQL |
You're right, the first path should be what's returned - I had them around the wrong way in my example above For this:
Agree this is probably more a GQL thing but if we want it in the API, IMO this could be it's own In regards to this example, just to be clear on my opinion:
I suggest a structure like:
I feel like address as a query param on The reason I dislike having
Thanks a lot for the discussions! |
yeah, But I'd personally keep the |
Info
Endpoint:
Response
Block Info and Statistics
Endpoints
URL queries
Boxes
Endpoints
URL queries
confirmed
is omitted or equal tonull
, then confirmed and unconfirmed boxes must be merged. Which means that new unconfirmed boxes must be added to returning array and confirmed boxes that are being spent in the mempool must be removed from the returning array.take
andskip
, I suggest usingcreationHeight
andboxId
, ascreationHeight
solely is not unique.Custom query endpoint
dApp constantly need to query for multiple contracts/addresses/templates/tokens, to potentially reduce the amount of roundtrips, I propose a custom query endpoint as described below.
Endpoint
Body
addresses
,contracts
,templates
,contractHashes
, andtemplateHashes
are exclusive.addresses
,contracts
,templates
,contractHashes
,templateHashes
, ortokens
needs to be defined for the query to be considered valid.Response
box.value
andbox.assets.amounts
must be typed asstring
, for improved compatibility.Tokens
Endpoints
Node Relay Endpoints
The following endpoint will serve as proxy endpoint for the node behind running uexplorer instance.
Endpoints
The text was updated successfully, but these errors were encountered: