• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Error 1014 Creating FTP User REST API

marccie

New Pleskian
Server operating system version
Ubuntu 22
Plesk version and microupdate number
18.0.53
Hi there,

I want to make a user using the REST API, but I get following message

JSON:
{
    "code" : 1014,
    "message" : "Parser error: Request is invalid. Error in line 1: Element 'webspace-id': '0' is not a valid value of the atomic type 'id_type'."
}

I'm sending following data to endpoint -X POST https://SERVER/api/v2/ftpusers

JSON:
{
    "home" : "/ftp-exports/customers/3",
    "name" : "USERNAME",
    "parent_domain" :
    {
        "guid" : "99999a99-999a-9a99-a999-9a9a9999a9a9",
        "id" : 2,
        "name" : "NAME"
    },
    "password" : "PASSWORD",
    "permissions" :
    {
        "read" : "true",
        "write" : "false"
    }
}
 
Although your data (body) seems fine, try and see if using only one identifier in the parent_domain object works. So only guid or id or name. For example:

JSON:
{
    "home" : "/ftp-exports/customers/3",
    "name" : "USERNAME",
    "parent_domain" :
    {
        "name" : "example.com"
    },
    "password" : "PASSWORD",
    "permissions" :
    {
        "read" : "true",
        "write" : "false"
    }
}
 
Although your data (body) seems fine, try and see if using only one identifier in the parent_domain object works. So only guid or id or name. For example:

JSON:
{
    "home" : "/ftp-exports/customers/3",
    "name" : "USERNAME",
    "parent_domain" :
    {
        "name" : "example.com"
    },
    "password" : "PASSWORD",
    "permissions" :
    {
        "read" : "true",
        "write" : "false"
    }
}
Hi Kaspar,

Thanks for your quick reply. I've tried with only parent_domain.name. Then with only parent_domain.id and then only parent_domain.guid but all with still the same error.
 
I suspect there might be a bug thats causing this issue, but I am not sure. I currently don't have an instance with the latest Plesk version (18.0.53) available to replicate the issue and I wasn't able te replicate the issue on a earlier version of Plesk (18.0.51). I suggest contacting Plesk Support so they can investigate the issue.
 
This is a known issue under the ID #EXTREST-158

Until the bug is fixed, the following workaround can be applied:

1. Create a secret key (X-API-Key):

Code:
# curl -iku admin:password -X POST -H 'Content-Type: application/json' -d'{}' https://hostname:8443/api/v2/auth/keys

2. Run the API-CLI call (make sure to replace required values such as hostname, X-API-Key, FTP user name, domain name, and password):

Code:
# curl -k -X POST "https://hostname:8443/api/v2/cli/ftpsubaccount/call" \
-H "X-API-Key: 67X1fX25-24dX-5eX8-bXe1-d9566X4Xf4X9" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "params": ["--create", "jdoe", "-domain", "example.com", "-home", "/httpdocs", "-passwd", "password"]}'
 
This is a known issue under the ID #EXTREST-158

Until the bug is fixed, the following workaround can be applied:

1. Create a secret key (X-API-Key):

Code:
# curl -iku admin:password -X POST -H 'Content-Type: application/json' -d'{}' https://hostname:8443/api/v2/auth/keys

2. Run the API-CLI call (make sure to replace required values such as hostname, X-API-Key, FTP user name, domain name, and password):

Code:
# curl -k -X POST "https://hostname:8443/api/v2/cli/ftpsubaccount/call" \
-H "X-API-Key: 67X1fX25-24dX-5eX8-bXe1-d9566X4Xf4X9" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "params": ["--create", "jdoe", "-domain", "example.com", "-home", "/httpdocs", "-passwd", "password"]}'
Hi Martin,

Excellent! This works for me now, thank you!
 
Something similar started happening on create database API as well after updating to latest version of Plesk. Do we have something to fix this as well?

I don't think we have option to revert Plesk to previous version

1688643163899.png
 
The same workaround should work using the CLI version over the API:

Updated the issue internally with the information that Database creation is also affected.
 
I just updated to 18.0.54 and this issue still persists. Most API calls are returning this error (create database user, create database etc)
 
I have the exact same issue.
{ "code": 1014, "message": "Parser error: Request is invalid. Error in line 1: Element 'webspace-id': '0' is not a valid value of the atomic type 'id_type'." }

This has broken our API which we depend on. I use the X-API-Key and the Basic authorization. Neither work.
Also it does not even work from the Plesk API Swagger tool from without the Admin.
 
Can someone from Plesk please advise what is happening, as this is a pretty bad bug? We have environments that depend on a working API.
 
Back
Top