These are the API calls for counting and deleting stale servers. A server can be called stale if it was last updated before a certain time limit.
This will get count of total servers vs. stale servers for a given time period.
curl -su <APIKEY>:U -H "Content-type: application/json" -XGET "https://api.copperegg.com/v2/servers/count_stale.json?days=x&months=y&years=z"
x = number of days as a positive non-zero integer
y = number of months as a positive non-zero integer
z = number of years as a positive non-zero integer
For eg, a sample request to list stale servers older than 10 days would be :
curl -su <APIKEY>:U -H "Content-type: application/json" -XGET "https://api.copperegg.com/v2/servers/count_stale.json?days=10&months=0&years=0"
Above request can also be reduced to skip months and years parameters because they are zero
curl -su <APIKEY>:U -H "Content-type: application/json" -XGET "https://api.copperegg.com/v2/servers/count_stale.json?days=10"
Total servers : <NUMBER_OF_SERVERS> , Stale servers : <NUMBER_OF_SERVERS_STALE_SINCE_GIVEN_PERIOD>
curl -su <APIKEY>:U -XDELETE "https://api.copperegg.com/v2/servers/destroy_stale.json?days=x&months=y&years=z"
x = no. of days as a positive non-zero integer
y = no. of months as a positive non-zero integer
z = no. of years as a positive non-zero integer
For eg, a sample request to delete stale servers older than 6 months would be :
curl -su <APIKEY>:U -XDELETE "https://api.copperegg.com/v2/servers/destroy_stale.json?days=0&months=6&years=0"
Above request can also be reduced to skip days and years parameters because they are zero
curl -su <APIKEY>:U -XDELETE "https://api.copperegg.com/v2/servers/destroy_stale.json?months=6"
Removed <NUMBER_OF_SERVERS_STALE_SINCE_GIVEN_PERIOD> stale servers out of <NUMBER_OF_SERVERS>