Get a user by ID

Returns an array of user objects that contains only the user specified by the id parameter, if it exists.

Jump to examples

Endpoint

{server_url}/users/{id}

Parameters

Name Type Value Description
id URL number The record ID of the user resource to return

Request headers

Header Value Required
Accept application/json No

Request body

None

Response body

Returns a user resource

Examples

GET example request

curl -G -H "Accept: application/json" \
    --url "http://localhost:3000/users/2"

GET example response

    {
        "lastName": "Jones",
        "firstName": "Jill",
        "email": "j.jones@example.com",
        "id": 2
    }

Response status

HTTP status value Description
200 Success: Requested data returned successfully
404 Error: Specified user record not found
ECONNREFUSED Service is offline. Start, or restart the service and try again.