To build custom Cloud Management API, it's necessary extend MID Server Script Include CloudRESTAPIInvoker, as in its description:
Abstracted class for making REST API calls. Classes that implement this need to extend this object and provide overrides for getEndpointUrl to return the targeted endpoint, and for getHeaders and/or getParameters if there are headers and/or parameters to send with a request.
CloudRESTAPIInvoker uses another MID Server Script Include CloudAPIBase to check if MID server is configured with proxy.
If MID server is using proxy, then the Custom API is forced to use proxy as well, by default.
This may break custom implementation like WAP (Windows Azure Pack), where the API is pointing to local servers, and the connection should not be going through web proxy.