Home
  • 한국어
  • ENGLISH
Home
  • 한국어
  • ENGLISH
  • API Guide
  • Withnox & Addnox

    • Introduction
    • Authentication
    • User
    • Analysis & History
  • LUX

    • Introduction
    • Authentication
    • Device
    • User

User

This page provides an overview of the APIs related to users in the Withnox & Addnox projects.

Introduction

The Withnox & Addnox User APIs allow for operations related to user accounts, such as retrieving and updating user information. We recommend reviewing the authentication section before making API calls.

Authentication

All User APIs require an authentication token. Please include the token in the Authorization header to authenticate the API calls.

Authorization: Bearer your_token_here

Replace your_token_here with the access_token obtained during the authentication process.

Endpoints

Retrieve User Information

Fetches information about the logged-in user. The response includes Boolean values indicating whether a password update is required if more than three months have passed since the last password change, and whether personal information needs to be updated.

GET /api/v1/addnox/user/me

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Request Example

GET /api/v1/addnox/user/me HTTPS
Authorization: Bearer your_token_here

Response Example

200 OK
{
    "root_user_id": 1,
    "first_name": "test",
    "last_name": "kim",
    "birthdate": "20240722",
    "gender": "M",
    "phone": "+821012345678",
    "is_phone_number_checked": true,
    "register_type": "E",
    "national_code": "KR",
    "need_personal_info_update": false,
    "need_to_pwd_change": true
}
ERROR

Error Responses

Refer to the table below for the API status codes and messages associated with each HTTP status code.

HTTP status codedetaildescription
401User is NoneNo user information found
401User is DeletedUser has been deleted
{
    "detail": "User is None"
}

Update User Information

Updates information for the logged-in user.

PATCH /api/v1/addnox/user/root-user

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
first_name optionalstringUser’s first name (excluding surname)
last_name optionalstringUser’s surname
birthdate optionalstringUser’s birthdate (yyyymmdd)
- ex : 19970101
gender optionalstringUser’s gender
- M : Male
- F : Female
- N : Non Binary
- P : Prefer Not to Say

Request Example

PATCH /api/v1/addnox/user/root-user HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json

{
  "first_name": "james",
  "last_name": "kim",
  "birthdate": "19970101",
  "gender": "M"
}

Response Example

200 OK
{
  "id": 1,
  "first_name": "james",
  "last_name": "kim",
  "birthdate": "19970101",
  "gender": "M",
  "phone": "+821012345678",
  "is_phone_number_checked": true,
  "register_type": "E"
}
ERROR

Error Responses

Refer to the table below for the API status codes and messages associated with each HTTP status code.

HTTP status codedetaildescription
401User is NoneNo user information found
401User is DeletedUser has been deleted
{
    "detail": "Real user not found"
}

Update User Push and Marketing Notifications

Updates the user's preferences for push and marketing notifications.

PATCH /api/v1/addnox/user/policy

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
is_push_agree optionalbooleanUser's consent for push notifications
is_marketing_agree optionalbooleanUser's consent for marketing communications

Request Example

PATCH /api/v1/addnox/user/policy HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json

{
  "is_push_agree": true,
  "is_marketing_agree": true
}

Response Example

200 OK
{
  "is_push_agree": true,
  "is_marketing_agree": true,
  "push_agree_date": "2024-10-28T07:47:53.563Z",
  "marketing_agree_date": "2024-10-28T07:47:53.563Z"   
}
ERROR

Error Responses

Refer to the table below for the API status codes and messages associated with each HTTP status code.

HTTP status codedetaildescription
404User not foundNo user information found
404User policy not foundNo user policy found.
{
    "detail": "User policy not found"
}

Set User Push Token

Stores the user's FCM token on the server to enable push notifications.

POST /api/v1/addnox/user/push/set-token

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
token requiredstringFCM token for push notifications

Request Example

POST /api/v1/addnox/user/push/set-token HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json

{
  "token": string
}

Response Example

200 OK
string
ERROR

Error Responses

Refer to the table below for the API status codes and messages associated with each HTTP status code.

HTTP status codedetaildescription
400Push permisson deniedUser disagreed the push permisson
409User push token update failedinvalid token type
{
    "detail": "Push permisson denied"
}

Delete User Account

Deletes the user account, deactivating the user's profile.

DELETE /api/v1/addnox/user/root-user

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Request Example

DELETE /api/v1/addnox/user/root-user HTTPS
Authorization: Bearer your_token_here

Response Example

200 OK
{
  "statusCode": 200, 
  "message": "Root user deleted"
}
ERROR

Error Responses

Refer to the table below for the API status codes and messages associated with each HTTP status code.

HTTP status codedetaildescription
404Sign in type is not foundCould not find the user type (email, social)
{
    "detail": "Sign in type is not found"
}

Create User Child Account and Register Device

Creates a child (sub-user) account and registers a device under this account. This endpoint combines the account creation and device registration processes for convenience.

POST /api/v1/addnox/user/create-real-user

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
first_name requiredstringFirst name of the child account
last_name requiredstringLast name of the child account
birthdate requiredstringBirthdate of the child account (yyyymmdd)
- ex : 19970101
gender requiredstringGender of the child account
- M : Male
- F : Female
- N : Non Binary
- P : Prefer Not to Say
serial_code requiredstringSerial code of the device to be registered
mac_id requiredstringMAC address of the device to be registered

Request Example

POST /api/v1/addnox/user/create-real-user HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json
{
  "first_name": "test",
  "last_name": "kim",
  "birthdate": "19970101",
  "gender": "F",
  "serial_code": "SL20401000",
  "mac_id": "00:80:E1:27:4C:84"
}

Response Example

200 OK
{
  "real_user_id": 1,
  "first_name": "test",
  "last_name": "kim",
  "birthdate": "19970101",
  "gender": "F",
  "device_id": 1,
  "now_firmware_id": 1,
  "unique_id": "string",
  "serial_code": "SL20401000",
  "device_alias": "string",
  "mac_id": "00:80:E1:27:4C:84",
  "last_log_file_id": 0,
  "created_at": "2024-10-28T08:09:47.889Z"
}
ERROR

Error Responses

Refer to the table below for the API status codes and messages associated with each HTTP status code.

HTTP status codedetaildescription
409Real user create failedReal user creation failed
401Not authorized userNo authorization to delete
404Not Found DeviceCould not find the device
409Already Connected DeviceDevice already connected to other user
{
    "detail": "Already Connected Device"
}

Retrieve User Child Account Information

Fetches information about a child (sub-user) account associated with the user. The real_user_id value can be obtained via /api/v1/addnox/device/get-all-device.

GET /api/v1/addnox/user/real-user/{real_user_id}

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Parameters

NameTypedescription
real_user_id requiredintegerID of the child account to retrieve

Request Example

GET https://app.nueyne.dev/api/v1/addnox/user/real-user/1 HTTPS
Authorization: Bearer your_token_here

Response Example

200 OK
{
  "id": 0,
  "root_user_id": 0,
  "first_name": "string",
  "last_name": "string",
  "birthdate": "string",
  "gender": "string"
}
ERROR

Error Responses

Refer to the table below for the API status codes and messages associated with each HTTP status code.

HTTP status codedetaildescription
401Not authorized userNo authorization
404Real user is not foundCould not find the real user
{
    "detail": "User is None"
}

Update User Child Account Information

Updates the information of a child (sub-user) account associated with the user.

PATCH /api/v1/addnox/user/update-real-user

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Body Parameters

NameTypedescription
id requiredintegerreal_user_id of the child account to update
first_name optionalstringFirst name of the child account
last_name optionalstringLast name of the child account
birthdate optionalstringBirthdate of the child account (yyyymmdd)
- ex : 19970101
gender optionalstringGender of the child account
- M : Male
- F : Female
- N : Non Binary
- P : Prefer Not to Say

Request Example

GET https://app.nueyne.dev/api/v1/addnox/user/real-user/1 HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json
{
  "id": 1,
  "first_name": "tester",
  "last_name": "john",
  "birthdate": "20010608",
  "gender": "P"
}

Response Example

200 OK
{
  "id": 1,
  "root_user_id": 1,
  "first_name": "tester",
  "last_name": "john",
  "birthdate": "20010608",
  "gender": "P"
}
ERROR

Error Responses

Refer to the table below for the API status codes and messages associated with each HTTP status code.

HTTP status codedetaildescription
401Not authorized userNo authorization
404Real user is not foundCould not find the real user
{
    "detail": "Not authorized user"
}

Delete User Child Account and Unregister Device

Deletes a child (sub-user) account and unregisters the associated device.

DELETE /api/v1/addnox/user/delete-real-user

Headers

NameTypedescription
Authorization requiredBeareraccess_token

Parameters

NameTypedescription
real_user_id requiredintegerID of the child account to delete
unique_id requiredstringUnique ID of the device to unregister

Request Example

DELETE /api/v1/addnox/user/delete-real-user HTTPS
Authorization: Bearer your_token_here
Content-Type: application/json
{
  "real_user_id": 1,
  "unique_id": "string",
}

Response Example

200 OK
{
  "statusCode": 200,
  "message": "Real user deleted successfully",
}
ERROR

Error Responses

Refer to the table below for the API status codes and messages associated with each HTTP status code.

HTTP status codedetaildescription
401Not authorized userNo authorization
404Real user is not foundCould not find the real user
409Real user delete failedReal user delete failed
{
    "detail": "Real user is not found"
}

Common Error Handling

The following error codes apply across all endpoints.

Error Response Example

  • 400 Bad Request: The request is invalid or missing required parameters.
    {
      "detail": "Invalid request or missing parameters"
    }
    
  • 401 Unauthorized: Authentication failed or the token is invalid.
    {
      "detail": "Could not validate credentials" // Token is incorrect or expired
    }
    
  • 404 Not Found: The specified resource could not be found.
    {
      "detail": "Resource not found"
    }
    
  • 500 Internal Server Error: An error occurred on the server.
    {
      "detail": "Internal server error. Please try again later."
    }
    
Last Updated:: 11/4/24, 1:36 AM
Contributors: Jeongtae Kim
Prev
Authentication
Next
Analysis & History