- Server operating system version
- ?
- Plesk version and microupdate number
- ?
Hello,
I am new here and am trying to create an Excel VBA script to create a new customer account via XML API.
The script looks like this:
As a result, I receive the following response:
What am I doing wrong?
The request "<packet><server><get_protos/></server></packet>" brings the same result.
Best regards
Peter
I am new here and am trying to create an Excel VBA script to create a new customer account via XML API.
The script looks like this:
Code:
Option Explicit
Sub PleskApiXMLRequest()
Dim sPleskHost As String
Dim sPleskLogin As String
Dim sPleskPassword As String
Dim sRequest As String
' Set the Plesk server URL, login and password
sPleskHost = "https://xyz.com:8443"
sPleskLogin = "..."
sPleskPassword = "..."
' Create a WinHttpRequest object
Dim oHttpRequest As New WinHttp.WinHttpRequest
' Open an HTTP connection to the Plesk server
oHttpRequest.Open "POST", sPleskHost & "/enterprise/control/agent.php HTTP/1.1", False
' Set the HTTP headers
oHttpRequest.SetCredentials sPleskLogin, sPleskPassword, 0
oHttpRequest.setRequestHeader "Content-type", "text/xml"
' Set the XML code for the API request
Dim sPname As String
Dim sLogin As String
Dim sPasswd As String
Dim sPlanName As String
sPname = "Fritz Mustermann
sLogin = "fritz"
sPasswd = "secret"
sPlanName = "Basis"
sRequest = "<packet><reseller><add><gen_info><pname>" & sPname & "</pname><login>" & sLogin & "</login><passwd>" & sPasswd & "</passwd></gen_info><limits><limit-name>max_subdomains</limit-name><value>10</value></limits><permissions><permission-name>manage_phosting</permission-name><value>true</value></permissions><pool/><plan-name>" & sPlanName & "</plan-name></add></reseller></packet>"
' Send the API request
oHttpRequest.send sRequest
' Get the API response
Dim sResponse As String
sResponse = oHttpRequest.responseText
' Print the API response in a message box
MsgBox sResponse
End Sub
As a result, I receive the following response:
Code:
-- Copyright 1999-2023. Plesk International GmbH. All rights reserved. --
html lang="en" dir="ltr"
head
meta charset="utf-8"
meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"
title 404 Page Not Found /title
link rel="shortcut icon" href="/favicon.ico"
link rel="stylesheet" href="/ui-library/plesk-ui-library.css?3.31.0"
script src="/ui-library/plesk-ui-library.min.js?3.31.0" /script
script src="/cp/javascript/vendors.js" /script
script src="/cp/javascript/main.js"> /script
script src="/error_docs/uat.js?v3" /script
link href="/error_docs/app.css?5ddcce66fe3b3bc08d68" rel="stylesheet"
/head
body
div id="app" /div
script window.__INITIAL_DATA__ = {"code":"404","message":"Page Not Found"} /script
script src="/error_docs/app.js?5ddcce66fe3b3bc08d68" /script
/body
What am I doing wrong?
The request "<packet><server><get_protos/></server></packet>" brings the same result.
Best regards
Peter