User
Introduction
This page explains the functionalities such as user connection, disconnection, checking biometric status, connecting wallets, obtaining userId via email, redeeming discounts, saving products, deleting products and scan history records, retrieving and updating user information, as well as deleting user accounts. For testing, please insert "https://sandbox-staging-app.berify.io" into the {
domain}
section of the URL.
Check biometrics status
POST /user/{
userId}
/biometrics/status-check
Checks the status of the given user’s biometric authentication (e.g., NotSet, Match, NotMatch, etc) based on the userId.
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Request parameters:
- userId: string
Request body:
- publicKey: string
Example:
- URL
- Body
https://{domain}/api/user/{userId}/biometrics/status-check
{
"publicKey": "123d112331d"
}
Response:
- status: string
- error: string
- HTTP 200
- HTTP 400
{
"status": "NotSet" | "Match" | "NotMatch"
}
{
"error": "id not found." | "Incorrect userID." | "User not found." | "Field(s) cannot be empty."
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.
Connect wallet
POST /user/{
userId}
/wallet
Saves the wallet number to the specific user's data in the database, based on the given userId. If the update is successful, it means that the wallet has been successfully linked to the user's account.
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Request parameters:
- userId: string
Request body:
- address: string
Example:
- URL
- Body
https://{domain}/api/user/{userId}/wallet
{
"address": "0x5890b********************888e479ab14ea52"
}
Response:
- userId: string
- address: string
- error: string
- HTTP 200
- HTTP 400
{
"userId": "c738ef3b-a882-40ef-a7e8-0474178f6631",
"address": "0x5890b********************888e479ab14ea52"
}
{
"error": "Invalid id."
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.
Get userId by email
GET /user/{
userId}
/getUserIdByEmail/{
email}
Saves the wallet number to the specific user's data in the database, based on the given userId. If the update is successful, it means that the wallet has been successfully linked to the user's account.
Optional header:
- Berify-App-User-Id: string
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Request parameters:
- userId: string
- email: string
Example:
- URL
https://{domain}/api/user/{userId}/getUserIdByEmail/{email}
Response:
- user:
- id: string
- error: string
- HTTP 200
- HTTP 400
{
"user": {
"id": "c738ef3b-a882-40ef-a7e8-0474178f6631"
}
}
{
"error": "Incorrect userID." | "You cannot make changes to this user." | "You are not logged in." | "Missing userId." | "Invalid email.";
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.
Save product
POST /user/{
userId}
/save-product/{
batchId}
Adds product(s) to a user's following list (or cart) and saves it to the database.
Optional header:
- Berify-App-User-Id: string
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Request parameters:
- userId: string
- batchId: string
Example:
- URL
https://{domain}/api/user/{userId}/save-product/{batchId}
Response:
- error: string
- HTTP 200
- HTTP 400
{}
{
"error": "You are not logged in." | "Incorrect userID." | "Incorrect digitalCustomizationId." | "You cannot make changes to this user." | "Missing userId." | "Missing digitalCustomizationId."
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.
Remove product
DELETE /user/{
userId}
/save-product/{
batchId}
Removes product(s) to a user's following list (or cart) and removes it from the database.
Optional header:
- Berify-App-User-Id: string
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Request parameters:
- userId: string
- batchId: string
Example:
- URL
https://{domain}/api/user/{userId}/save-product/{batchId}
Response:
- error: string
- HTTP 200
- HTTP 400
{}
{
"error": "You are not logged in." | "Incorrect userID." | "Incorrect digitalCustomizationId." | "You cannot make changes to this user." | "Missing userId." | "Missing digitalCustomizationId."
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.
Remove scan history
DELETE /user/{
userId}
/scan-history/{
id}
Deletes a user’s specific scanned tag record from the database based on the scanId of the given record.
Optional header:
- Berify-App-User-Id: string
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Request parameters:
- userId: string
- id: number
Example:
- URL
https://{domain}/api/user/{userId}/scan-history/{id}
Response:
- error: string
- HTTP 200
- HTTP 400
{}
{
"error": "You are not logged in." | "Incorrect userID." | "You cannot make changes to this user." | "Missing userId." | "Missing scanHistoryId."
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.
Remove all scan history
DELETE /user/{
userId}
/scan-history
Deletes all of a given user's scanned tag records from the database.
Optional header:
- Berify-App-User-Id: string
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Request parameters:
- userId: string
Example:
- URL
https://{domain}/api/user/{userId}/scan-history
Response:
- error: string
- HTTP 200
- HTTP 400
{}
{
"error": "You are not logged in." | "Incorrect userID." | "You cannot make changes to this user." | "Missing userId."
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.
Get user
GET /user/{
userId}
Retrieves the user's account information, including firstName and lastName.
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Optional header:
- Berify-App-User-Id: string
Request parameters:
- userId: string
Example:
- URL
https://{domain}/api/user/{userId}
Response:
- user:
- email: string
- phone: string
- firstName: string
- lastName: string
- error: string
- HTTP 200
- HTTP 400
{
"user": {
"email": "test@gamil.com",
"phone": "+1-582***743",
"firstName": "Kevin",
"lastName": "Chen"
}
}
{
"error": "You are not authorized to call this API." | "Incorrect userId." | "Authentication type error." | "User not found."
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.
Update user
PUT /user/{
userId}
Updates the user’s account information, which includes image, firstName, and lastName.
Optional header:
- Berify-App-User-Id: string
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Request parameters:
- userId: string
Request body:
- image: string
- firstName: string
- lastName: string
- username: string
Example:
- URL
- Body
https://{domain}/api/user/{userId}
{
"image": "https://www.example.com",
"firstName": "Kevin",
"lastName": "Chen",
"username": "Kevin Chen"
}
Response:
- user:
- id: string
- email: string
- phone: string
- image: string
- firstName: string
- lastName: string
- error: string
- HTTP 200
- HTTP 400
{
"user": {
"id": "c738ef3b-a882-40ef-a7e8-0474178f6631",
"email": "test@gamil.com",
"phone": "+1-582***743",
"image": "https://textimage.image.com",
"firstName": "Kevin",
"lastName": "Chen"
}
}
{
"error": "You are not logged in." | "Incorrect userID." | "You cannot make changes to this user." | "You are not authorized to call this API."
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.
Delete user
DELETE /user/{
userId}
Deletes the user’s account.
Optional header:
- Berify-App-User-Id: string
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Request parameters:
- userId: string
Example:
- URL
https://{domain}/api/user/{userId}
Response:
- user:
- id: string
- email: string
- emailVerified: Date
- phone: string
- phoneVerified: Date
- image: string
- firstName: string
- lastName: string
- password: string
- salt: string
- biometricsKey: string
- isDelete: boolean
- isActive: boolean
- isAdmin: boolean
- error: string
- HTTP 200
- HTTP 400
{
"user": {
"id": "c738ef3b-a882-40ef-a7e8-0474178f6631",
"email": "test@gmail.com",
"emailVerified": "2024-03-14T09:28:26.770Z",
"phone": "+1-582***743",
"phoneVerified": "2024-03-14T09:28:26.770Z",
"image": "https://textimage.image.com",
"firstName": "Kevin",
"lastName": "Chen"
"password": "59bea5d30f920706a193d************************17ac1be88eb5bd85e1291840f3a6592a79776",
"salt": "'bae*****-****-****-****-*****c970a32'",
"biometricsKey": "MIIBIjANBgkqhkiG9**********CAQ8AMIIBCgKCAQEAudd/JHncJ/************************************************************/cpNj2nON44WsrI16IIQGiqnqtvk883CO3YcZ+5yYiO3u**********bhWkVYGT2F0hwSE/************************************************************/yRB7PM+ZnhAFVDLJO**********ePBUuwxH6nqw6/************************************************************",
"isDelete": true,
"isActive": true,
"isAdmin": true
}
}
{
"error": "User not found." | "Incorrect userID." | "You cannot make changes to this user." | "You are not logged in." | "You are not authorized to call this API."
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.
Get wallet
GET /user/{
userId}
/wallet
Retrieves a specific user's wallet based on the given userId.
Optional header:
- Berify-App-User-Id: string
Request header:
- secretKey: string. Use "App-Berify-Secret".
- secret: string
Request parameters:
- userId: string
Example:
- URL
https://{domain}/api/user/{userId}/wallet
Response:
- address: string[]
- error: string
- HTTP 200
- HTTP 400
{
"address": [
"0x5890b********************888e479ab14ea52"
]
}
{
"error": "Invalid id." | "Incorrect userID." | "You cannot make changes to this user." | "You are not logged in." | "Missing userId."
}
HTTP status code summary:
200
(OK) - Everything worked as expected.401
(Unauthorized) - Invalid or missing access token.405
(Method Not Allowed) - Unacceptable HTTP method for requested resource.