The User API Schema contains the user account information. In this module, it will let you:
- Create an account
- Log in to the user account
- Get user account information
- Update user account properties
Field | Type | Description |
---|---|---|
id
|
string | The unique user ID and the sort key. |
user_type
|
string |
The type of this account. There are 2 different user types: 1 = "ADMIN" 2 = "CUSTOMER" |
first_name
|
string | The first name of the user. |
last_name
|
string | The last name of the user. |
username
|
string | The username of the user account and the primary key. |
password
|
string | The user security password for the account. |
address
|
string | The user address. |
email
|
string | The user e-mail address. |
mobile_number
|
string | The user phone number. |
date_created
|
string | The date that this account was created. |
last_login
|
string | The last login session of the user. |
Key | Value |
---|---|
Content-Type
|
application/json
|
Setting to application/json
is recommended.
Status Code | Description |
---|---|
200 | OK |
400 | Bad Request |
500 | Internal Server Error |
To create a new user account instance, you need to instantiate an object that represents a user account property. The user account instance holds the information related to the user.
Method: POST
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/user/create
Field | Type | Description | Required |
---|---|---|---|
user_type
|
string |
The type of this account. There are 2 different user types: 1 = "ADMIN" 2 = "CUSTOMER" |
✅ |
first_name
|
string | The first name of the user. | ✅ |
last_name
|
string | The last name of the user. | ✅ |
username
|
string | The username of the user account. | ✅ |
password
|
string |
Minimum length: 8 The user security password for the account. |
✅ |
address
|
string | The user address. | ✅ |
email
|
string | The user e-mail address. | ✅ |
mobile_number
|
string | The user phone number. | ✅ |
{
"user_type": "1",
"first_name": "Emily",
"last_name": "Davis",
"username": "emilydavis",
"password": "passwordabc",
"address": "321 Cedar Road",
"email": "emilydavis@example.com",
"mobile_number": "4449876543"
}
By providing the username
and password
in the payload, the authentication process will be initiated, allowing the user to access their account. Upon successful login, it will return a representation of an account that is related to the user as a response.
Method: POST
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/user/login
Field | Type | Description | Required |
---|---|---|---|
username
|
string | The username of the user account. | ✅ |
password
|
string |
Minimum length: 8 The user security password for the account. |
✅ |
Payload:
{
"username": "emilydavis",
"password": "passwordabc"
}
Response:
{
"id": "ADMN-878495",
"user_type": "ADMIN",
"first_name": "Emily",
"last_name": "Davis",
"username": "emilydavis",
"address": "321 Cedar Road",
"email": "emilydavis@example.com",
"mobile_number": "4449876543"
}
When retrieving the specific user account information, the id
and username
query parameters must be present in the URL. These parameters identify which user account should be returned. It will either return a representation of a specific an account that is related to the user or a list of user account.
Method: GET
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/user/account/get
Query Parameters
Parameter | Type | Description | Required |
---|---|---|---|
id
|
string | The user account unique ID. | ✅ |
username
|
string | The username of the user account. | ✅ |
[
{
"id": "ADMN-878495",
"user_type": "ADMIN",
"first_name": "Emily",
"last_name": "Davis",
"username": "emilydavis",
"address": "321 Cedar Road",
"email": "emilydavis@example.com",
"mobile_number": "(407) 435-6841"
}
]
When modifying the user profile, the id
and username
query parameters must be present in the URL. These parameters identify which user account should be modified. After the update is performed, it will return a representation of the updated account information.
Method: POST
Endpoint: https://{api_id}.execute-api.{region}.amazonaws.com/prod/user/account/update?id=xxxxx&username=xxxxx
Parameter | Type | Description | Required |
---|---|---|---|
id
|
string | The user account unique ID. | ✅ |
username
|
string | The username of the user account. | ✅ |
Field | Type | Description | Required |
---|---|---|---|
first_name
|
string | The first name of the user. | ❌ |
last_name
|
string | The last name of the user. | ❌ |
address
|
string | The user address. | ❌ |
email
|
string | The user e-mail address. | ❌ |
mobile_number
|
string | The user phone number. | ❌ |
Payload:
{
"mobile_number": "(407) 435-6841"
}
Response:
{
"id": "ADMN-878495",
"user_type": "ADMIN",
"first_name": "Emily",
"last_name": "Davis",
"username": "emilydavis",
"password": "passwordabc",
"address": "321 Cedar Road",
"email": "emilydavis@example.com",
"mobile_number": "(407) 435-6841",
"date_created": "1687849585"
}