User Registration API
Used to implement user registration functionality. Supports passing parameters via GET or POST methods. Required information includes application ID and user account. Optional extended information such as QQ and email can be passed. The application signature is obtained directly from the backend.
Request URL GET / POST
http
https://nobase.cn/api/user/registerRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| appid | string | ✅ Yes | Application ID, the unique identifier of the application obtained from the developer center |
| signature | string | ✅ Yes | Application signature, obtained directly from the backend (no manual generation needed, bound to appid) |
| user | string | ✅ Yes | User account, unique identifier used for login (such as phone number, username) |
| pass | string | ✅ Yes | User password, recommended to be MD5 encrypted before passing |
| nickname | string | ✅ Yes | User nickname, name used for display (supports Chinese, special symbols) |
| string | ❌ No | User QQ number, optional, used for account association or recovery | |
| string | ❌ No | Email address, optional, used for account verification or password recovery | |
| imag | string | ❌ No | Avatar link, needs to be used with an image hosting service, optional (default avatar will be used if not provided) |
Response Example
Success Response (Registration Successful)
json
{
"code": 200,
"msg": "success",
"data": "Registration successful"
}Failure Response (Account already exists/Application does not exist)
json
{
"code": 404,
"msg": "fail",
"data": "This account has already been registered!"
}json
{
"code": 404,
"msg": "Application does not exist"
}Response Data Structure
| Parameter | Type | Description |
|---|---|---|
| code | number | Status code: 200=Registration successful, 400=Parameter error/Business failure, 500=System error |
| msg | string | Status description: success=Success, fail=Failure |
| data | string | Response information: Returns "Registration successful" on success, returns specific error reason on failure (such as "Account already exists", "Signature error") |
Code Example
javascript
// 1. Configure parameters (required fields need to be replaced with actual values, signature obtained from backend)
const appid = "your_app_id"; // Application ID (required)
const signature = "your_signature_from_backend"; // Application signature (obtained from backend, required)
const user = "user123456"; // User account (required)
const pass = md5("user_password123"); // User password (MD5 encrypted, required, need to import md5 library first)
const nickname = "User Nickname"; // User nickname (required)
// Optional parameters (do not pass if not available)
const qq = "123456789";
const email = "user@example.com";
const imag = "https://example.com/avatar.jpg";
// 2. Concatenate GET parameters (handle optional parameters, do not add if not available)
const params = new URLSearchParams({
appid,
signature,
user,
pass,
nickname
});
if (qq) params.append('qq', qq);
if (email) params.append('email', email);
if (imag) params.append('imag', imag);
// 3. Initiate GET request
const requestUrl = `https://nobase.cn/api/user/register?${params.toString()}`;
fetch(requestUrl)
.then(response => {
if (!response.ok) throw new Error(`HTTP Error: ${response.status}`);
return response.json();
})
.then(res => {
if (res.code === 200) {
console.log("Registration result:", res.data); // Output "Registration successful"
} else {
console.error("Registration failed:", res.data); // Output specific error
}
})
.catch(error => console.error("Request exception:", error));javascript
// 1. Configure parameters (same as GET, signature obtained from backend)
const appid = "your_app_id";
const signature = "your_signature_from_backend";
const user = "user123456";
const pass = md5("user_password123");
const nickname = "User Nickname";
// 2. Initiate POST request
fetch('https://nobase.cn/api/user/register', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
appid,
signature,
user,
pass,
nickname
})
})
.then(response => response.json())
.then(res => {
if (res.code === 200) {
console.log("Registration successful:", res.data);
} else {
console.error("Registration failed:", res.data);
}
});python
import requests
import hashlib
# Configuration parameters
appid = "your_app_id"
signature = "your_signature_from_backend"
user = "user123456"
pass = hashlib.md5("user_password123".encode()).hexdigest() # MD5 encryption
nickname = "User Nickname"
url = "https://nobase.cn/api/user/register"
params = {
"appid": appid,
"signature": signature,
"user": user,
"pass": pass,
"nickname": nickname
}
response = requests.get(url, params=params)
res_data = response.json()
if res_data["code"] == 200:
print(f"Registration successful: {res_data['data']}")
else:
print(f"Registration failed: {res_data['data']}")Precautions
- Password Security: Although MD5 encryption is recommended, please use HTTPS for transmission to ensure security.
- Account Uniqueness: The account must be unique within the same application. Duplicate registration will return an error.
- Signature Validity: Please ensure obtaining the correct signature from the backend. An incorrect signature will cause registration to fail.
- Avatar Link: The avatar needs to use a complete URL address. It is recommended to use an image hosting service to store images.

