User Resource

The User resource represents user accounts in GroveStreams. A user belongs to zero or more organizations. An organization can have one to many users. Users can be deleted even if they belong to an Org. They will be removed automatically from all organizations they own or are members of.

Internally a User is keyed by a UID, not the user's email address. Users can change their email address without impacting relationships to other entities. There are two types of users in the system: User and OrgUser. An OrgUser is formed for each user organization relationship.

A list of organizations the user belongs to will be part of the json response for the User GET action. The Organization array is ignored during User PUT/POST actions. A user is added or removed to an Organization via the OrgUser Resource.

User's passwords are initially set during a User PUT. The password is encrypted and stored in the database. The password is never unencrypted again and the encrypted password is never passed between servers.

GET user/{userUid}



Get the user with the specified uid.
Resource Information
Rate Limited? Yes
session token compatible? Yes
api_key compatible No
org token required? No

Resource URL

http://grovestreams.com/api/user/{userUid}

Parameters

none


Example Requests

/User/d251a8f2-f7b9-4df7-886d-b24c7f4929d4/

Response Body
{
    "message" : "",    "user" : {
       "uid" : "d251a8f2-f7b9-4df7-886d-b24c7f4929d4",
       "lastName" : "Flintstone",
       "organization" : [     {
        "uid": "cd3e6d0b-4b7b-430f-8c2a-01bdf655ee74",
        "name": "Grove Streams Testing Suite",
        "isOwner": true,
        "type": "organization"
      }],
       "phoneNumber" : "111-555-1111",
       "email" : "user1",
       "firstName" : "Fred"
    },
    "success" : true
}


GET user/new



Returns a default user entity with a unique UID. Does not persist the new user entity. It's the callers responsibility to PUT the new user.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? No
api_key compatible No

Resource URL

http://grovestreams.com/api/user/new

Parameters

none

Example Requests

/user/new

Response Body
{
    "message" : "",
    "user" : {
       "uid" : "d251a8f2-f7b9-4df7-886d-b24c7f4929d4",
       "lastName" : "",
       "organization" : [],
       "phoneNumber" : "",
       "email" : "",
       "firstName" : ""
    },
    "success" : true
}


GET user/



Get the user with the passed in email address.
Resource Information
Rate Limited? Yes
session token compatible? Yes
api_key compatible No
org token required? No

Resource URL

http://grovestreams.com/api/user?email=some_user@gmail.com

Parameters

email
mandatory
The email address  of the user

Example Requests

/user?some_user@gmail.com

Response Body
{
    "message" : "",
    "user" : {
       "uid" : "d251a8f2-f7b9-4df7-886d-b24c7f4929d4",
       "lastName" : "Flintstone",
       "organization" : [],
       "phoneNumber" : "111-555-1111",
       "email" : "some_user@gmail.com",
       "firstName" : "Fred"
    },
    "success" : true
}


GET user/email_exists/{email}



Determines if an email exists within GroveStreams.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? No
api_key compatible No
org token required? No

Resource URL

http://grovestreams.com/api/user/email_exists/{email}

Parameters

none

Example Requests

user/email_exists/some_user@gmail.com

Response Body
{
    "message" : "",
    "emailExists" : true,
    "success" : true
}


GET user/confirm/{email}/{confirmationCode}



Used to confirm a user's account after they've signed up (via PUT user call). A user cannot sign in until their account has been confirmed. The confirmationCode should've been emailed to the user during the PUT user.

Ensure parameters are properly encoded.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? No
api_key compatible No

Resource URL

http://grovestreams.com/api/user/confirm/{email}/{confirmationCode}

Parameters

none

Example Requests

user/confirm/some_user@gmail.com/d251a8f2-f7b9-4df7-886d-b24c7f4929d4

Response Body
{
    "message" : "User account confirmed.",
    "success" : true
}


POST user/{userUid}/password



Resets a user's password. Requires the old password to be passed with the new password. The old password is validated. The session must be for the user being updated - that is, only the logged in user can update their password. Once a password is saved it will never be returned outside of the grovestreams service.
Resource Information
Rate Limited? Yes
session token compatible? Yes
api_key compatible No
org token required? No

Resource URL

http://grovestreams.com/api/user/{userUid}/password

Parameters

none

Example Requests

/user/d251a8f2-f7b9-4df7-886d-b24c7f4929d4/password

Request Body
{
   "user" : {
       "uid" : "ca88b036-5b94-4ac6-b46d-a9976be02850",
       "password" : "b",
       "oldPassword" : "a"
    }
}


POST user



Used to update user information. Do not include the user's password. The session must be for the user being updated - that is, only the logged in user can update their own information. Resource Information
Rate Limited? Yes
session token compatible? Yes
api_key compatible No
org token required? No

Resource URL

http://grovestreams.com/api/user

Parameters

none

Example Requests

/user

Request Body
{
    "user" : {
       "uid" : "ca88b036-5b94-4ac6-b46d-a9976be02850",
       "lastName" : "name2",
       "phoneNumber" : "111-555-1111",
       "email" : "user2",
       "firstName" : "Fred"
    }
}


PUT user



Creates a new user. The user account will be created but the state of the user will be REGISTERING and the user account will be disabled. This call will trigger a confirmation email to be sent to the user (using the passed in email address). Once the user confirms their registration within the email, the state of the user account will be "REGISTERED" and the user account will be available and the user will be able to log into GroveStreams.

If the UID is blank a new UID will be created on the server for the new user.  The user entity will be returned with the UID that the server created.

ReCaptcha challenge and response tokens must be included in the call. The server will make a call to ReCaptcha and validate the challenge and result.


Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? No
api_key compatible No

Resource URL

http://grovestreams.com/api/user

Parameters

confirmPhoneNum
optional
Phone number to send a registration confirmation code to.
confirmEmailCodeOnly
optional
Email address to send a registration confirmation code to.

Example Requests

/user

Request Body
{
    "user" : {
       "uid" : "ca88b036-5b94-4ac6-b46d-a9976be02850",
       "lastName" : "name2",
       "phoneNumber" : "111-555-1111",
       "email" : "user2",
       "firstName" : "Fred"
    }
    "captcha_result" : "*****",
}


DELETE user/{userUid}



Removes the user's account from GroveStreams and removes the user from any organizations they may own or belong to.

The user will not be deleted if they own any organizations. The organizations need to be deleted first.
Resource Information
Rate Limited? Yes
session token compatible? Yes
api_key compatible No
org token required? No

Resource URL

http://grovestreams.com/api/user/{userUid}

Parameters

none

Example Requests

/user/d251a8f2-f7b9-4df7-886d-b24c7f4929d4

Response Body
{
    "message" : "Deleted User with uid 'd251a8f2-f7b9-4df7-886d-b24c7f4929d4'",
    "success" : true
}