Enterprise API interaction with Design Center

Table of Contents

This is a simple walkthrough of a System::motd sketch activation against CFEngine Enterprise Hub 192.168.33.2. There are several steps. The most important step is where we define the sketch parameters. Those are exactly what the Mission Portal Design Center App generates through the GUI.

Sample API call to Install sketch

{
    "System::motd":
    {
        "params\/debian_squeeze.json":"sketches\/system\/motd\/params\/debian_squeeze.json",
        "README.md":"sketches\/system\/motd\/README.md",
        "params\/example.json":"sketches\/system\/motd\/params\/example.json",
        "sketch.json":"sketches\/system\/motd\/sketch.json",
        "params\/debian_wheezy.json":"sketches\/system\/motd\/params\/debian_wheezy.json",
        "main.cf":"sketches\/system\/motd\/main.cf",
        "params\/simple.json":"sketches\/system\/motd\/params\/simple.json"
    },
    "sketches":{"System::motd":1}
}

Sample API call to Define sketch parameters

{
    'params': {'prepend_command': '/bin/uname -snrvm', 'motd_path': '/etc/motd', 'motd': 'hello dude2'},
    'sketchName': 'System::motd'
}
  • RESULT: {"myfirstsketchdefinition":1}

Sample API call to Define environment

Sample API call to Activate sketch

{
  'environmentName': 'mymotdenvironment',
  'bundleName': 'entry',
  'paramName': 'myfirstsketchdefinition',
  'sketchName': 'System::motd'
}
  • RESULT:
{
  "System::motd":
  {
    "hash":"6cefdfedd0de3933c2ecac420b8d2aad",
    "params":["myfirstsketchdefinition"],
    "environment":"mymotdenvironment",
    "identifier":"myfirstsketchActivation",
    "target":"sketches",
    "bundle":"entry",
    "metadata":{"identifier":"myfirstsketchActivation","timestamp":1402657585}
  }
}

Sample API call to Commit changes