Hello,
I was wondering if anyone else ever tried to use the object URL ?
It seems pretty simple, but for some reason, the remote server always answer me as if my post was empty.
I tried it with a curl, and it works perfectly with my post.
So the issue must be with my code, but I also noticed that the object URL in the API Explorer, from the postContent method, it says that I should pass a string value.
But if I take the HTTP post workflow, its passing a string value, so I'm confused.
Also, i'm using vRO 7.0
Here's the code I've developped:
var urlObject = new URL(url + user + "&_secret=" + password);
if (os.toLowerCase() == 'sles'){
var folder_os = "unix/linux/assemblage";
} else if (os.toLowerCase() == 'windows') {
var folder_os = "windows/windows 2012/assemblage";
} else {
throw ("OS non supporte");
}
var content = "{\"attributes\":{" +
"\"ipaddress\":\"" + fqdn + "\"},\"hostname\":\"" + servername + "\"" +
",\"folder\":\"" + folder_os + "\"}";
System.log("URL: " + url + user + "&_secret=" + password);
System.log("PostContent :" + content);
result = urlObject.postContent(content);
System.log(result);