Is there any plans to include a REST API that you could access from any other application to automate the process.
- Add new Machine
- Automate tasks and monitor them
I don't speak C# , but isn't there already such an API (at least partially) in web/App_Code/Service/ ?
I also see some
curl command in the web/private/clientscripts/cd_global_functions and friends, that seems to use such an API.
If so, how blessed is that API (e.g. how likely it is to change). Please note that in lieu of any other API, we fall back to writing our own service that will access the underlying database , which if will break, I guess, we get to keep both halves.
If that API is really a thing, can you possibly post a usage example to save us some try/err iterations?
We might need to supplement that API with database access, but every bit that might make our code more robust will be welcome.
(Partially) answering myself:
There is indeed some web API, for the benefit of the client scripts and it is invoked with the
A typical curl command looks like this:
curl --show-error --insecure \ --header "Authorization:$(echo -n $USER_TOKEN | base64)" \ --data $ARG1=$VAL1&$ARG2=$VAL2[...] \ "http://$CLONEDEPLOY_HOST/clonedeploy/service/client.asmx/$WEB_METHOD" \ --connect-timeout 10 \ --stderr -
$WEB_METHODs can be found in web/App_Code/Service/Client/Client.cs and are decorated with
The formal arguments of those methods becomes
Return values are rendered with:
$USER_TOKEN should be found in the security settings of the C/D webapp.
Methods that requires the
$USER_TOKEN starts with:
if (!Authorize()) return;
http://$CLONEDEPLOY_HOST/clonedeploy/service/client.asmx/ string can be found in the boot scripts in the C/D webapp as
Unfortunately the entry points I really need for my testing automation are missing: namely I need to drive the schedule of a new deploy task for a given computer with a given image. The logic seem to be implemented in web/App_Code/Service/ComputerController.cs and TaskController.cs , but there seem to be no
[WebMethod] entry point for it.
Am I correct in assuming that in some point such an API was in the planning but it was never realized?
Yes, that is mostly correct. The Computer and Task Controller's are functional, I believe. It's been awhile since I've test them. You should be able to view the examples at http://$CLONEDEPLOY_HOST/clonedeploy/apitest
You can also see the API progress in the 1.3.0 branch.