GTStudio API帮助文档

1. 关于API

GTStudio API是一个用于访问和管理用户数据的RESTful API。

2. 如何使用

要使用GTStudio API,请查看以下文档:

基本网址

所有API接口都使用相同的基本URL - https://api.gtstudio.top

2.1 用户注册

要注册新用户,请向 /api/v1/sign 发送 POST 请求,提供必要的用户信息。

						# 注册新用户的示例请求
						POST /api/v1/sign HTTP/1.1
						Host: https://api.gtstudio.top
						Content-Type: application/json
					
						{
							"key": "your-api-key",
							"account": "new_user",
							"Email": "user@example.com",
							"password": "user_password",
							"Name": "User Name",
							"Data": "Additional user data"
						}
					

服务器将会返回以下信息:

200 响应(注册成功)

						{
							'message': 'Registration successful'
						}
					

400 响应(账号已存在)

						{
							'message': 'Account already exists'
						}
					

401 响应(api-key错误)

						{
							'message': 'Invalid key'
						}
					

500 响应(内部服务器错误)

						<!doctype html>
						<html lang=en>
						<title>500 Internal Server Error</title>
						<h1>Internal Server Error</h1>
						<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
					

2.2 用户登录

要登录,请向 /api/v1/login 发送 POST 请求,提供用户凭证。

						# 用户登录的示例请求
						POST /api/v1/sign HTTP/1.1
						Host: https://api.gtstudio.top
						Content-Type: application/json
					
						{
							"key": "your-api-key",
							"account": "new_user",
							"password": "user_password",
						}
					

服务器将会返回以下信息:

200 响应(登录成功,返回用户信息,并进行Gzip压缩,中文字符会被进行usc2编码)

						{
							'Name': 'User_Name',
							'Uuid':'User_uuid',
							'Token':'abcdefghijklmnopqrstyvwxyz12345678',
							'Email':'user@example.com',
							"Data": "Additional user data"
						}
					

404 响应(账号不存在)

						{
							'message': 'User not found'
						}
					

401 响应(api-key错误)

						{
							'message': 'Invalid key'
						}
					

500 响应(内部服务器错误)

						<!doctype html>
						<html lang=en>
						<title>500 Internal Server Error</title>
						<h1>Internal Server Error</h1>
						<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
					

2.3 生成令牌

要生成随机令牌,请向 /api/v1/generate_token 发送 POST 或 GET 请求。

						# 生成随机令牌的示例请求
						GET /api/v1/generate_token?length=32 HTTP/1.1
						Host: https://api.gtstudio.top
					

200 响应(生成成功,返回生成的Token)

					HTTP/1.1 200 OK
					Content-Type: application/json
				
					{
						"token": "8a4f19a5f043e8ba2607e152ea36d7f6"
					}
					

500 响应(内部服务器错误)

						<!doctype html>
						<html lang=en>
						<title>500 Internal Server Error</title>
						<h1>Internal Server Error</h1>
						<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
					

2.4 更新用户账号数据

要更新用户账号数据,请向 /api/v1/update_userdata 发送 POST 请求。

						# 生成随机令牌的示例请求
						POST /api/v1/update_userdata HTTP/1.1
						Host: https://api.gtstudio.top
					

200 响应(更新成功)

						HTTP/1.1 200 OK
						Content-Type: application/json
						
						{
							"message": "User data update completed"
						}
					

401 响应(api-key错误)

						{
							'message': 'Invalid key'
						}
					

500 响应(内部服务器错误)

						<!doctype html>
						<html lang=en>
						<title>500 Internal Server Error</title>
						<h1>Internal Server Error</h1>
						<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>