Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

  1. Gets the list of all deployed views

    Code Block
    GET /api/v1/views
    
    200 - OK
  2. Once you have a list of views, you can drill-into a view and see the available versions.

    Code Block
    GET /api/v1/views/FILES
    
    200 - OK
  3. You can go a level deeper and see more information about that specific version for the view, such as the parameters and the archive name, and a list of all instances of the view for that specific view version.

    Code Block
    GET /api/v1/views/FILES/versions/0.1.0
    
    200 - OK

Creating a View Instance: Files View

The following example shows creating an instance of the FILES view Files View, name FILES, version 0.1.0 .0 view called "MyFiles".

  1. Create the view instance.

    Code Block
    POST /api/v1/views/FILES/versions/0.1.0.0/instances/MyFiles
    
    [ {
    "ViewInstanceInfo" : {
        "properties" : {
          "dataworker.defaultFs" : "webhdfs://your.namenode.host:50070"
        }
      }
    } ]
    
    201 - CREATED

    Set view properties.

    Info

    When creating your view instance, be sure to provide all required view instance properties, otherwise you will receive a 500 with a message explaining the properties that are required.

  2. Restart Ambari Server to pick-up the view instance and UI resources.

    Code Block
    ambari-server restart
  3. Confirm the newly created view instance is available.

    Code Block
    GET
    Code Block
    PUT /api/v1/views/FILES/versions/0.1.0
    
    {
      "href" : "http://c6401.ambari.apache.org:8080/api/v1/views/FILES/versions/0.1.0/",
      "ViewVersionInfo" : {
        "archive" : "/var/lib/ambari-server/resources/views/work/FILES{0.1.0}",
        "label" : "Files",
        "masker_class" : null,
        "parameters" : [
          {
            "name" : "dataworker.defaultFs",
            "description" : "FileSystem URI",
            "required" : true,
            "masked" : false
          },
          {
            "name" : "dataworker.username",
            "description" : "The username (defaults to ViewContext username)",
            "required" : false,
            "masked" : false
          }
        ],
        "version" : "0.1.0",
        "view_name" : "FILES"
      },
      "permissions" : [ ],
      "instances" : [
        {
          "href" : "http://c6401.ambari.apache.org:8080/api/v1/views/FILES/versions/0.1.0/instances/MyFiles",
          "ViewInstanceInfo" : {
            "instance_name" : "MyFiles",
            "version" : "0.1.0",
            "view_name" : "FILES"
          }
        }
      ]
    }
  4. Browse to the view instance directly.

    Code Block
    http://c6401.ambari.apache.org:8080/views/FILES/0.1.0/MyFiles/
    
    or
    
    http://c6401.ambari.apache.org:8080/#/main/views/FILES/0.1.0/MyFiles

Creating a View Instance: Capacity Scheduler View

The following example shows creating an instance of the Capacity Scheduler View, name CAPACITY-SCHEDULER, version 0.1.0 view called "CS_1", using the label "Capacity Scheduler".

  1. Create the view instance.

    Code Block
    POST /api/v1/views/CAPACITY-SCHEDULER/versions/0.1.0/instances/CS_1
    
    [ {
    "ViewInstanceInfo" : {
        "label" : "Capacity Scheduler",
        "properties" : {
          "dataworkerambari.server.defaultFsurl" : "webhdfs://your.namenode.host:50070http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster",
          "ambari.server.username" : "admin",
          "ambari.server.password" : "admin"
        }
      }
    } ]
    
    200201 - OKCREATED
    Info

    When creating your view instance, be sure to provide all required view instance properties, otherwise you will receive a 500 with a message explaining the properties that are required.

  2. Restart Ambari Server to pick-up the view instance and UI resources.

    Code Block
    ambari-server restart
  3. Confirm the newly created view instance is available.

    Code Block
    GET /api/v1/views/CAPACITY-SCHEDULER/FILESversions/0.1.0
    
    {
      "href" : "http://127c6401.0ambari.0apache.1org:8080/api/v1/views/FILESCAPACITY-SCHEDULER/versions/0.1.0.0/",
      "ViewInfoViewVersionInfo" : {
        "archive" : "/var/lib/ambari-server/resources/views/work/filesCAPACITY-0.SCHEDULER{0.1-SNAPSHOT-jar-with-dependencies.jar.0}",
        "label" : "Capacity Scheduler",
        "Files"masker_class" : null,
        "parameters" : [
          {
            "name" : "dataworker.defaultFs"ambari.server.url",
            "description" : "Target Ambari Server REST API cluster URL (for example: http://ambari.server:8080/api/v1/clusters/c1)",
            "required" : true,
            "masked" : false
          },
          {
            "name" : "ambari.server.username",
            "description" : "Target Ambari administrator username (for example: admin)",
            "required" : true,
            "masked" : false
          },
          {
            "name" : "ambari.server.password",
            "description" : "FileSystem URITarget Ambari administrator password (for example: admin)",
            "required" : true,
            "masked" : false
          }
        ],
        "version" : "0.1.0.0",
        "view_name" : "FILESCAPACITY-SCHEDULER"
      },
      "permissions" : [ ],
      "instances" : [
        {
          "href" : "http://127c6401.0ambari.0apache.1org:8080/api/v1/views/FILESCAPACITY-SCHEDULER/versions/0.1.0.0/instances/MyFilesCS_1",
          "ViewInstanceInfo" : {
            "instance_name" : "MyFiles"CS_1",
            "version" : "0.1.0",
            "view_name" : "FILESCAPACITY-SCHEDULER"
          }
        }
      ]
    }
  4. Browse to the view instance directly.

    Code Block
    http://127.0.0.1:8080/views/FILES/1.0.0/MyFilesc6401.ambari.apache.org:8080/views/CAPACITY-SCHEDULER/0.1.0/CS_1/
    
    or
    
    http://c6401.ambari.apache.org:8080/#/main/views/CAPACITY-SCHEDULER/0.1.0/CS_1/