Tạo nhiều tài khoản

Tạo nhiều tài khoản

Tạo nhiều tài khoản

POST https://abc.hoola.vn/manage/api/users/create-multi-user

Để tránh trường hợp timeout request và dễ theo dõi kết quả, chỉ nên tạo tối đa 100 tài khoản trong một lần truy vấn. Lưu ý, thông số của từng tài khoản trong mảng danh sách tài khoản phải đáp ứng yêu cầu sau: - Họ và tên tài khoản phải là kiểu chuỗi (string), độ dài tối thiểu 3 ký tự; - Username phải là kiểu chuỗi (string), không có khoảng trống, không có ký tự đặc biệt, chấp nhận các ký tự a-z, A-Z, 0-9, độ dài phải từ 3 đến 20 ký tự; - Password phải có độ dài từ 6 đến 35 ký tự. Cách trường thông tin tuỳ chọn của tài khoản: - phone: Số điện thoại, - city: Tỉnh, thành phố, - district: Quận, huyện, -street: Đường, phố, - gender: Giới tính (Nam/Nữ), - job: Nghề nghiệp Khoảng cách thời gian giữa các lần truy vấn tạo nhiều tài khoản nên tối thiểu là 10 phút để tránh trường hợp truy vấn quá nhiều làm server quá tải.

Query Parameters

Name
Type
Description

token

string

Token xác thực tài khoản của bạn

Request Body

Name
Type
Description

users

array

Mảng danh sách thông tin các tài khoản cần tạo (bao gồm tên, username, email và password)

Mã phản hồi respCode "00". Data trả về gồm số lượng tài khoản tạo thành công và tạo không thành công 
{
    "respCode": "00",
    "users": [
        {
            "name": "Nguyễn Văn A",
            "username": "nguyenvana",
            "email": "[email protected]",
            "password": "1234567890",
            "userId": null,
            "success": false,
            "status": "Email already in use"
        },
        {
            "name": "Lê Việt B",
            "username": "levietb",
            "email": "[email protected]",
            "password": "1234567890",
            "userId": "msnJmaPa7KmtEzz3q",
            "success": true,
            "status": "Success created"
        },
        {
            "name": "Nguyễn Văn C",
            "username": "nguyenvanc",
            "email": "[email protected]",
            "password": "1234567890",
            "userId": "urs2vByNw9ETg9XYZ",
            "success": true,
            "status": "Success created"
        },
        {
            "name": "Trần Xuân D",
            "username": "tranxuand",
            "email": "[email protected]",
            "password": "1234567890",
            "userId": "MPC5B5dsdYD9Ak283",
            "success": true,
            "status": "Success created"
        },
        {
            "name": "Phạm Văn E",
            "username": "phamvane",
            "email": "[email protected]",
            "password": "1234567890",
            "userId": "cc95fXX5PTX5qDR9R",
            "success": true,
            "status": "Success created"
        },
        {
            "username": "nguyenxuanq",
            "email": "[email protected]",
            "password": "1234567890",
            "userId": null,
            "success": false,
            "status": "Not enough required infomation to create new user"
        },
        {
            "username": "lexuank",
            "email": "[email protected]",
            "userId": null,
            "success": false,
            "status": "Not enough required infomation to create new user"
        }
    ],
    "msg": "4 success, 3 error"
}

Ví dụ về tạo nhiều tài khoản:

POST:
https://abc.hoola.vn/manage/api/users/create-multi-user?token=sdhg23797sdbv9186jdvk58

body: {
    users: [
        {
            name: "Nguyễn Văn A",
            username: "nguyenvana",
            email: "[email protected]",
            password: "1234567890",
            phone: "0987654321",
            city: "Hà Nội",
            district: "Quận Cầu Giấy",
            street: "40 Hoàng Đạo Thuý",
            gender: "Nam",
            job: "Giáo viên THCS"
        },
        {
            name: "Lê Việt B",
            username: "levietb",
            email: "[email protected]",
            password: "1234567890",
            phone: "0987654321",
            city: "Hà Nội",
            district: "Quận Ba Đình",
            street: "60 Điện Biên Phủ",
            gender: "Nam",
            job: "Lái xe"
        },
        {
            name: "Nguyễn Lan Hương",
            username: "nguyenlanhuong",
            email: "[email protected]",
            password: "1234567890",
            phone: "0987654321",
            city: "Hà Nội",
            district: "Quận Thanh Xuân",
            street: "130 Nguyễn Trãi",
            gender: "Nữ",
            job: "Chuyên viên văn "
        },
        {
            name: "Trần Xuân D",
            username: "tranxuand",
            email: "[email protected]",
            password: "1234567890"
        },
        {
            name: "Phạm Văn E",
            username: "phamvane",
            email: "[email protected]",
            password: "1234567890"
        }
    ]
}

Last updated

Was this helpful?