Echoo文档中心Echoo文档中心
Home
Echoo HTTP API
Home
Echoo HTTP API
  • 租赁服-加入服务器 /api/rental/enter

租赁服-加入服务器 /api/rental/enter

您可以使用这个API加入服务器信息并获取host和ip(主要目的)

返回API列表

请求地址

POST /api/rental/enter

请求头

无

请求参数

调用类型:POST form-data

  • user_id 登录返回的userid
  • e_id 填写之前接口中获取的entity_id
  • password 服务器密码,可空,如果获取服务器时has_pwd不为0则必填

调用返回

返回类型:Json

返回示例:

{ "code": 0, "message": "获取成功", "host": "IP地址", "port": 25565 }

参数解释:

  • code——只有code为0时代表请求成功,如果请求失败错误原因会显示在message里
  • message——错误信息或成功信息
  • host——F服务器IP地址 string
  • port——服务器端口 int64

特殊返回注意事项:

如果code返回为-2请重新调用get_server_info获取服务器信息!!!

示例代码

Python:

import requests
from requests_toolbelt import MultipartEncoder

url = 'http://127.0.0.1:21000/api/rental/enter'

m = MultipartEncoder(
    fields={
        'user_id': ('', 'user_id'),
        'e_id': ('', 'entity_id'),
        'password': ('', '服务器密码'),
    }
)

headers = {
    'Content-Type': m.content_type
}

response = requests.post(url, data=m, headers=headers)

print(response.status_code)
print(response.text)
最近更新:: 2025/11/23 19:14