Make authorization model endpoints HATEOAS / HAL compliant #158
geoffroybraun
started this conversation in
Ideas
Replies: 1 comment
-
Hey @geoffroybraun - thanks for the suggestion. We will take that into consideration. However in regards to your use case: Our SDKs try to be helpful and expose a method called Do you have a use-case in mind where you would need a particular model but don't know it's ID and it's not latest, but you know the page number? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Nowadays, we can retrieve all authorization models by calling the endpoint
/stores/{store_id}/authorization-models
, which allows us to specify how many items we want per page using the query parameterpage_size
. Unfortunatly, only acontinuation_token
is retrieved, which can not indicate how many authorization models can still be retrieved, forcing us to call the same endpoint again and again until recieving less ahtorization models than specified in the query or checking if a token has been provided.A successful solution would be to use HATEOAS HAL specification.
With that, the endpoint could retrieve authorization models with pagination links calculated on the fly depending on how many models are currently stored in the database, but also links related to the model itself within the object. Here is an example when calling
/stores/{store_id}/authorization_models
withpage_size=1
andpage_index=2
:In the example above, the links
self
,first
,last
andcreate
are permanent, whileprev
andnext
are optional, depending on the current page index and authorization models count. With that, it would be much easier for an API consumer to navigate thouth all available authorization models, as everything would be provided by the API itself.As usual, let me know if further information are required. Cheers!
Beta Was this translation helpful? Give feedback.
All reactions