Skip to content
Alex Crowley edited this page Feb 17, 2017 · 7 revisions

Users belong to a particular organization. There are varying roles that a user can take from user to company recruiter. Any comment left for a student is tied to a User account

API Overview

The following routes are supported for performing operations on the User entity.

RegisterUser POST /user
Login POST /auth/login GetUser GET /user/{userKey}
GetUsers GET /user/org/{orgKey}
GetUsersByOrgName GET /user/orgName/{orgName}
UpdateUser PUT /user/{userKey}
DeleteUser DELETE /user/{userKey}

JSON Representation:

User Structure

A user contains sufficient information to be able to login and perform operations on behalf of an organization.

name string Name
email string Email address, used for authentication
password string Account password, think about not returning when getting User(s), code was removed at some point

API Reference

Note: to run in Postman, just take the information contained in the quotes of --data and paste in the body field.

RegisterUser

Registers a User to the database

URL Structure:

http://xtern-matching.appspot.com/user

Example Request:

curl -X POST http://xtern-matching.appspot.com/user \
--data '{"name": "Joe Smith",
         "email":"somewhere@gmail.com",
         "password":"user1",
         "orgKey": 123456}'

Returns

None

Errors

Conflict 409:

User already exists in Datastore

Internal Server Error 500:

Error executing query
Error hashing password
Invalid structure for Datastore


Login

Attempts a login with the given credentials and generates a web token for authentication

URL Structure:

xtern-matching.appspot.com/login

Example Request:

curl -X POST xtern-matching.appspot.com/login \
--data '{ "email":"somewhere@gmail.com",
          "password":"user1"}'

Returns

{token: , organizationName : }


#### Errors

##### Internal Server Error 500:
>	Error hashing password  
	Error validating user

***

### <a name="GetUser"></a>GetUser
>	Gets the corresponding user associated with the particular key

#### URL Structure:
>	xtern-matching.appspot.com/user/{userKey}

#### Example Request:
```bash
curl -X GET xtern-matching.appspot.com/user/123456

Returns

User JSON Representation

Errors
Internal Server Error 500:

Error executing query
Datastore ErrFieldMismatch if types do not agree of if data structure models differ


GetUsers

Gets Users that are associated with a particular organization

URL Structure:

xtern-matching.appspot.com/user/org/{orgKey}

Example Request:

curl -X GET xtern-matching.appspot.com/user/org/123456

Returns

List_of(User JSON Representation)

Errors
Internal Server Error 500:

Error executing query
Error decoding orgKey Datastore ErrFieldMismatch if types do not agree of if data structure models differ


GetUsersByOrgName

Gets Users that are associated with a particular organization by organization name

URL Structure:

xtern-matching.appspot.com/user/orgName/{orgKey}

Example Request:

curl -X GET xtern-matching.appspot.com/user/orgName/"Qualcomm"

Returns

List_of(User JSON Representation)

Errors
Internal Server Error 500:

Error executing query
Error getting orgKey from orgName Datastore ErrFieldMismatch if types do not agree of if data structure models differ


UpdateUser

Updates a user in the database. Uses the Id provided in the JSON request body to update the User. If the password is to remain the same, use "" for the value

URL Structure:

xtern-matching.appspot.com/user/

Example Request:

curl -X PUT xtern-matching.appspot.com/user/123456 \
--data '{"name": "Joe Smith",
	 "email":"somewhere-different@gmail.com", 
         "password":"user1"}'

Returns

None

Errors

Internal Server Error 500:

Error hashing new password
Datastore ErrFieldMismatch if types do not agree of if data structure models differ


DeleteUser

Removes a User from the database

URL Structure:

xtern-matching.appspot.com/user/{userKey}

Example Request:

curl -X DELETE xtern-matching.appspot.com/user/6348855016685568

Returns

None

Errors

Internal Server Error 500:

Error deleting User in Datastore