• 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

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