java-ovh icon indicating copy to clipboard operation
java-ovh copied to clipboard

DELETE operations result in INVALID_SIGNATURE

Open xkuyax opened this issue 6 years ago • 0 comments

Hi, im trying to use the api to purchase and delete instances from the cloud api. The get and post methods for purchasing work flawlessly, but if i try to delete an instance i get an "OvhApiException [ovhCause=BAD_PARAMETERS_ERROR] : {"errorCode":"INVALID_SIGNATURE","httpCode":"400 Bad Request","message":"Invalid signature"}" error.

I then tried to delete an ssh key, where i got the same error. I have checked my "/auth/currentCredential" rules which return "{ "method":"DELETE", "path":"/*" }", which should work if im correct.

I also double checked my URLs which should be right.

Here is my test code for deleting an ssh key, which does not work.

        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("keyId","59584e6b");
        jsonObject.addProperty("serviceName",ovhData.getServiceName());
        String path = "/cloud/project/" + ovhData.getServiceName() + "/sshkey/59584e6b";
        System.out.println(path);
        ovhApi.delete(path,jsonObject.toString(),true);

Other methods like get ovhApi.get("/auth/currentCredential",true); work just fine

xkuyax avatar Nov 13 '17 11:11 xkuyax