• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

How I have set expiration date for client add from API RPC XML(C#)

A

AvisS

Guest
Hi,

I am C# developer. I have written some code for clients (user) add from Local system to plesk web server through API. I have used API RPC protocol version is 1.4.2.0 .


The code is working fine for me. But main problem in that, I can’t set those clients expiration date.

Here is some XML request
<limits>
<disk_space>100000</disk_space>
<max_dom>50</max_dom>
<max_subdom>250</max_subdom>
<max_webapps>30</max_webapps>
<max_traffic>50000</max_traffic>
<max_db>200</max_db>
<mysql_dbase_space>50000</mysql_dbase_space>
<max_shared_ssl_links>50</max_shared_ssl_links>
<expiration>1134616208</expiration>
</limits>


Can you please suggest me, here which date format is used?


Thanks,
Avis
 
Hi IgorG,

No, it is not working properly.

Here is my code:sb.Append("<expiration>" + DateTime.Now.AddYears(1).Date.ToString("yyyyMMdd") + "</expiration>");

And XML request is: <expiration>20120112</expiration>

After that when I have added the client, it shows expiration date is 21- Aug – 1970


Thanks,
Avis
 
Same error here ...

yyyyMMdd format is not valid, I get a date of 1970

I change expiration with control panel and I get the date "1298329200" as 25-Feb-2011...
 
Try to use http://www.epochconverter.com/ to calc your date

"The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds"

In C# you can try:
epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
 
Back
Top