Authentication
Authenticating a user
Section titled “Authenticating a user”/api/v1/$FLOCK/user/auth/
| Method | Description |
|---|---|
| POST | Authenticate a user |
| DELETE | Log out |
http POST https://api.sheepcrm.com/api/v1/$FLOCK/user/auth/ email=jim@nasa.gov password=space
HTTP/1.1 201 CREATED{ "bearer_token": "1abcdefg:abcedfgh", "connected_flocks": [ "example", "example-association" ], "email": "jim@nasa.gov", "first_name": "Jim", "flock_data": { "example": true, "example-association": true }, "last_name": "Lovell", "path_upon_activation": null, "reset_token": null, "reset_token_expiry": "2019-11-13T20:56:00.835000", "session_expiry": "2020-02-25T20:19:59.770000", "status": "active", "username": "1abcdefg"}http DELETE https://api.sheepcrm.com/api/v1/$FLOCK/user/auth/ Authorization:"Bearer $API_KEY"
HTTP/1.1 200 OK{ "status": "ok"}Pre-authenticate a user
Section titled “Pre-authenticate a user”/api/v1/$FLOCK/user/preauth/
Use this to check the existence of an account. Missing accounts will return a 404. Where appropriate an activation code will be sent to the user.
| Parameter | Required | Description |
|---|---|---|
| Yes | The email address must be a valid email address | |
| quick | No | Setting to true is recommended |
http POST https://api.sheepcrm.com/api/v1/$FLOCK/user/preauth/ email=james@example.com quick=true
HTTP/1.0 200 OK{ "crypt": "$2b$12$hu1BFQBaqRVhLijXu/s5muiFekeYIu6r6jlNnB8NvY6JdiRB341sO", "email": "james@example.com", "first_name": "James", "status": "preregistered", "username": "****"}Pre-registering a new user
Section titled “Pre-registering a new user”/api/v1/$FLOCK/user/preregister/
This method will pre-register a new user without an account activation process. An active session will be opened but the status of preregistered will limit access.
| Parameter | Required | Description |
|---|---|---|
| Yes | The email address must be a valid email address | |
| require_activation | No | Defaults to true. Set false to prevent an activation email being sent to the new user |
http POST https://api.sheepcrm.com/api/v1/$FLOCK/user/preregister/ email=james@example.com
HTTP/1.0 200 OK{ "bearer_token": "~~~", "connected_flocks": [ "sheep-app" ], "email": "james@example.com", "first_name": null, "flock_data": {}, "last_name": null, "path_upon_activation": null, "reset_token": "~~~", "reset_token_expiry": "2020-05-12T11:53:10.379000", "session_expiry": "2020-05-11T23:53:15.870000", "status": "preregistered", "username": "~~~"}Registering a new user
Section titled “Registering a new user”/api/v1/$FLOCK/user/register/
| Parameter | Required | Description |
|---|---|---|
| Yes | The email address must be a valid email address | |
| terms | Yes | The user must have accepted the terms and conditions of sheepCRM |
http POST https://api.sheepcrm.com/api/v1/$FLOCK/user/register/ email=new-user@example.com terms=Y
HTTP/1.1 201 CREATED{ "email": "new-user@example.com", "status": "created", "username": "f3dc4260b8"}Activate a user
Section titled “Activate a user”/api/v1/$FLOCK/user/activate/
| Parameter | Required | Description |
|---|---|---|
| token | Yes | The composite username and activation token {username}:{reset token} |
http POST https://api.sheepcrm.com/api/v1/$FLOCK/user/activate/ token=abc:123
HTTP/1.1 200 OK{ "bearer_token": "***", "connected_flocks": [ "sheep-app", "example" ], "email": "***", "first_name": null, "flock_data": { "person_uri": "/example/person/5eb92c0280859e45bd056133/" }, "last_name": null, "path_upon_activation": null, "reset_token": "***", "reset_token_expiry": "2020-05-12T10:42:11.790000", "session_expiry": "2020-05-11T23:19:54.850000", "status": "active", "username": "abc"}Confirm email address without activating account
Section titled “Confirm email address without activating account”/api/v1/$FLOCK/user/activate_single/
| Parameter | Required | Description |
|---|---|---|
| token | Yes | The composite username and activation token {username}:{reset token} |
http POST https://api.sheepcrm.com/api/v1/$FLOCK/user/activate_single/ token=abc:123
HTTP/1.1 200 OK{ "bearer_token": "***", "connected_flocks": [ "sheep-app", "example" ], "email": "***", "first_name": null, "flock_data": { "person_uri": "/example/person/5eb92c0280859e45bd056133/" }, "last_name": null, "path_upon_activation": null, "reset_token": null, "reset_token_expiry": "2020-05-12T10:42:11.790000", "session_expiry": "2020-05-11T23:19:54.850000", "status": "activation-required", "username": "abc"}Additional endpoints
Section titled “Additional endpoints”| Endpoint | Description |
|---|---|
/api/v1/$FLOCK/user/ | User account management |
/api/v1/$FLOCK/user/reset/ | Password reset |
/api/v1/$FLOCK/user/password/ | Set password using token |