Users¶
- Get users
- Get a user by ID
- Get questions created by user ID
- Get votes by user ID
Note
- Add support for HATEOAS
- Show the available fields for every user
- Add support for create a new user
- GET /users¶
Get the details about the lasts created users.
Example request:
GET /users?fields="first_name,last_name,city,country,signed_on" Host example.com Accept: application/vnd.preguntale.v1+json
Example response:
[ { "first_name": "John", "last_name": "Doe", "city": "Monterrey", "country": "mx", "signed_on": "date" }, { "first_name": "John", "last_name": "Doe", "city": "Monterrey", "country": "mx", "signed_on": "date" } ]
Query Parameters: - fields (str) – A list of comma separated users fields. Otherwise all the available fields should be returned.
- per_page (int) – The maximum number of users objects that will be returned by request, no more than 100.
- page (int) – The offset by per_page users. Otherwise, returns the first page of users.
- sort (str) – The order by which the list of users will be returned based on the date and time the user was created, asc or desc. Default: desc.
Request Headers: - Accept – application/vnd.preguntale.v1+json
Response Headers: - Content-Type – application/json
- X-RateLimit-Limit – 1000 per day
- X-RateLimit-Remaining – Number of requests remaining
- X-RateLimit-Reset – The time at which the current rate limit window resets (epoch time)
Status Codes: - 200 – no error
- 400 – bad request
- 404 – Nobody has not registered yet.
- GET /users/(int: user_id)¶
Get the details about the user.
Example request:
GET /users/1?fields="first_name,last_name,city,country,signed_on" Host example.com Accept: application/vnd.preguntale.v1+json
Example response:
{ "first_name": "John", "last_name": "Doe", "city": "Monterrey", "country": "mx", "signed_on": "date" }
Query Parameters: - fields (str) – A list of comma separated users fields. Otherwise all the available fields should be returned.
Request Headers: - Accept – application/vnd.preguntale.v1+json
Response Headers: - Content-Type – application/json
- X-RateLimit-Limit – 1000 per day
- X-RateLimit-Remaining – Number of requests remaining
- X-RateLimit-Reset – The time at which the current rate limit window resets (epoch time)
Status Codes: - 200 – no error
- 400 – bad request
- 404 – There is no user with this ID.