dimanche 7 avril 2019

Is it OK to have too long RESTful endpoint?

My service has 3 kinds of model classes which are User, Project, Simulation.

The problem is Projects are consist of 6 levels.

User > Proejct(lv1) > Project(lv2) > Project(lv3) > Project(lv4) > Project(lv5) > Project(lv6) > Simulation

I made a RESTful endpoint URL based on the hierarchy,
and the final result looks like this.

http://MY_SERVER.com/project/rest/team-members/{userId}/divisions/{divisionId}/products/{productId}/bgatypes/{bgaTypeId}/devices/{deviceId}/ballcounts/{ballCountId}/pkgsizes/{pkgSizeId}/simulations

I wonder if I'm doing the wrong design of RESTful protocol since the URL is becoming too long.

Is it better to use query parameters instead of path variables?
Any advice will be thankful.

Aucun commentaire:

Enregistrer un commentaire