So. You have an Orchestrator but you're one of those tech weirdies who doesn't like UIs. Maybe you're an exclusively backdoor kinda person whose chin drips with drool at the sight of a shapely API. That's between you and your shrink. But while you figure it all out, here are some wrappers and examples to help you get off
the ground with the Orchestrator API. Try to contain your excitement.
To use:
- Select whichever language makes your eyes twinkle
- Insert the orchestrator file into your pwd
- Mimic the sample calls made in the test file (No need to authenticate. This happens automatically)
Orchestrator orch = new Orchestrator("tenant", "user", "password");
Map res;
// GET
res = orch.request("get", "odata/Environments", null);
System.out.println(res);
// POST
JsonObject body = new JsonObject();
body.addProperty("Name", "Caesar");
body.addProperty("ValueScope", "Global");
body.addProperty("ValueType", "Text");
body.addProperty("StringValue", "Et tu asset 2");
res = orch.request("post", "odata/Assets", body.toString());
System.out.println(res);
/*See Test file for imports and error handling*/
const Orchestrator = require('./orchestrator.js');
var orch = new Orchestrator("tenant", "username", "password");
// GET
orch.request({ type: "GET",
extension: 'odata/Environments',
callback: printResult });
// POST
orch.request({ type: "POST",
extension: 'odata/Assets',
body: JSON.stringify({ Name: "Caesar", ValueScope: "Global" }),
callback: printResult });
// Callback
function printResult(response) {
console.log(response);
}
from orchestrator import Orchestrator
orch = Orchestrator("tenant", "username", "password")
# GET
res = orch.request('get', 'odata/Environments')
print(res)
# POST
res = orch.request('post', 'odata/Assets', {'Name': "Caesar",
'ValueScope': "Global",
'ValueType': "Text",
'StringValue': "Et tu asset 2"})
print(res)
require_relative 'orchestrator'
orch = Orchestrator.new("tenant", "user", "password")
# GET
response = orch.request('get', 'odata/Environments')
puts response["body"]["value"]
# POST
response = orch.request('post', 'odata/Assets', {Name: "Caesar",
ValueScope: "Global",
ValueType: "Text",
Value: "Et tu asset 2",
StringValue: "Et tu asset 2"})
puts response["body"]
To use:
- Go to Import>Import from link and add https://www.getpostman.com/collections/21ccbf63948df8ae7a84
- Create a new Environment1 with the following variables:
url
,tenancyName
,usernameOrEmailAddress
, andpassword
, matching each to your Orchestrator credentials. Your calls will now be authenticated automatically.
1: Or just import this environment file and update the variables.