senaite / senaite.jsonapi

RESTful JSON API for SENAITE
https://www.senaite.com
GNU General Public License v2.0
11 stars 19 forks source link

Users Route is disfunctional #17

Open ramonski opened 6 years ago

ramonski commented 6 years ago

Steps to reproduce

Navigate to the Users route /@@API/users

Current behavior

Route is not found

Expected behavior

Users are listed

Screenshot (optional)

image

juangallostra commented 6 years ago

@ramonski should the route /@@API/users actually list the users? To navigate to the users I have to go to /@@API/senaite/v1/users.

If /@@API/users is expected to list the users I can work on that but I prefer to have first your confirmation.

ramonski commented 6 years ago

Yes, exactly. It works similar to your settings route and the code is located here: https://github.com/senaite/senaite.jsonapi/blob/master/src/senaite/jsonapi/v1/routes/users.py

However, the issue is that this route is kind of taken by the route registrations for the contents: https://github.com/senaite/senaite.jsonapi/blob/master/src/senaite/jsonapi/v1/routes/content.py#L40

See the displayed message for e.g. https://senaite.ridingbytes.com/@@API/senaite/v1/users:

{
    "_runtime": 0.015951156616210938,
    "message": "Could not build url for endpoint 'senaite.jsonapi.v1.get' with values ['username']. Did you forget to specify values ['resource', 'uid']?",
    "success": false
}

Just take care that the users are only listed for authenticated users and not for anonymous. Thanks!