因此,尝试使用Plesk的REST API(从版本17.8开始提供)用于工作中的项目,并且我开始感受它。我一直试图尝试添加域名,但是当我必须指定托管类型时,它会给我错误。
请求正文本身如下:
{
"name":"example.com",
"hosting_type":"virtual",
"description":"Description goes here"
}
这得到以下神秘的回应:
{
"code": 1014,
"message": "htype\/vrt_hst is specified but there is no hosting\/vrt_hst"
}
根据/api/v2/swagger.yml
提供的文档,应允许以下任何值:virtual
,standard_forwarding
,frame_forwarding
,none
无论我投入什么,我都会得到上述回复的变体(htype\/{type} is specified but there is no hosting\/{type}
)。
此时我被卡住了;我不确定要检查什么,当我尝试查找错误代码时,任何引用都会转到Plesk的XML API参考。这需要什么来获取请求才能生效?
答案 0 :(得分:1)
看起来未指定系统用户 - hosting_settings。尝试使用完整的json请求添加域。这是一个例子:
{
"name": "example.com",
"description": "My website",
"hosting_type": "virtual",
"hosting_settings": {
"ftp_login": "test_login",
"ftp_password": "test_pwd"
},
"base_domain": {
"id": 7,
"name": "a10-52-41-48.qa.plesk.ru",
"guid": "b623e93d-dc72-4102-b5f0-ded427cf0fb1"
},
"parent_domain": {
"id": 7,
"name": "a10-52-41-48.qa.plesk.ru",
"guid": "b623e93d-dc72-4102-b5f0-ded427cf0fb1"
},
"owner_client": {
"id": 7,
"login": "a10-52-41-48.qa.plesk.ru",
"guid": "b623e93d-dc72-4102-b5f0-ded427cf0fb1",
"external_id": "b623e93d-dc72-4102-b5f0-ded427cf0fb1"
},
"ipv4": [
"212.192.122.46"
],
"ipv6": [
"2002:5bcc:18fd:c:123:123:123:123"
],
"plan": {
"name": "Unlimited"
}
}
REST API https://app.swaggerhub.com/apis/plesk/api/v2#/Domains/post_domains
的示例