Updated on 2022-06-01 GMT+08:00

WebHCat

  • The following uses the service IP address of WebHCat node and the WebHCat HTTP port configured during the installation as an example.
  • The user.name parameter must be added for APIs except :version, status, version, version/hive, and version/hadoop.

:version(GET)

  • Description

    Query a list of response types supported by WebHCat.

  • URL

    http://www.myserver.com/templeton/:version

  • Parameter

    Parameter

    Description

    :version

    WebHCat version number. Currently, the version number must be v1.

  • Return result

    Parameter

    Description

    responseTypes

    List of response types supported by WebHCat

  • Example
    curl -ik -u : --negotiate 'http://10.64.35.144:9111/templeton/v1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

status (GET)

  • Description

    Obtain the status of the current server.

  • URL

    http://www.myserver.com/templeton/v1/status

  • Parameter

    None

  • Return result

    Parameter

    Description

    status

    If the WebChat connection is normal, OK is returned.

    version

    Character string, including the version number, for example, v1

  • Example
    curl -ik -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/status'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

version (GET)

  • Description

    Obtain the WebHCat version of the server.

  • URL

    http://www.myserver.com/templeton/v1/version

  • Parameter

    None

  • Return result

    Parameter

    Description

    supportedVersions

    All supported versions

    version

    WebHCat version of the server

  • Example
    curl -ik -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/version'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

version/hive (GET)

  • Description

    Obtain the Hive version of the server.

  • URL

    http://www.myserver.com/templeton/v1/version/hive

  • Parameter

    None

  • Return result

    Parameter

    Description

    module

    hive

    version

    Hive version

  • Example
    curl -ik -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/version/hive'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

version/hadoop (GET)

  • Description

    Obtain the Hadoop version of the server.

  • URL

    http://www.myserver.com/templeton/v1/version/hadoop

  • Parameter

    None

  • Return result

    Parameter

    Description

    module

    hadoop

    version

    Hadoop version

  • Example
    curl -ik -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/version/hadoop'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl (POST)

  • Description

    Execute a DDL statement.

  • URL

    http://www.myserver.com/templeton/v1/ddl

  • Parameter

    Parameter

    Description

    exec

    HCatalog DDL statement to be executed

    group

    User group used when DDL is used to create a table

    permissions

    Permission used when DDL is used to create a table. The format is rwxr-xr-x.

  • Return result

    Parameter

    Description

    stdout

    Standard output value during HCatalog execution. The value may be empty.

    stderr

    Error output during HCatalog execution. The value may be empty.

    exitcode

    Return value of HCatalog

  • Example
    curl -ik -u : --negotiate -d exec="show tables" 'http://10.64.35.144:9111/templeton/v1/ddl?user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database (GET)

  • Description

    List all databases.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database

  • Parameter

    Parameter

    Description

    like

    Regular expression used to match the database name

  • Return result

    Parameter

    Description

    databases

    Database name

  • Example
    curl -ik -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/ddl/database?user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db (GET)

  • Description

    Obtain details about a specified database.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db

  • Parameter

    Parameter

    Description

    :db

    Database name

  • Return result

    Parameter

    Description

    location

    Database location

    comment

    Database remarks. If there are no database remarks, the value does not exist.

    database

    Database name

    owner

    Database owner

    ownertype

    Type of the database owner

  • Example
    curl -ik -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/ddl/database/default?user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db (PUT)

  • Description

    Create a database.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db

  • Parameter

    Parameter

    Description

    :db

    Database name

    group

    User group used for creating the database

    permission

    Permission used for creating the database

    location

    Database location

    comment

    Database remarks, for example, description

    properties

    Database properties

  • Return result

    Parameter

    Description

    database

    Name of the newly created database

  • Example
    curl -ik -u : --negotiate -X PUT -HContent-type:application/json -d '{"location": "/tmp/a", "comment": "my db", "properties": {"a": "b"}}' 'http://10.64.35.144:9111/templeton/v1/ddl/database/db2?user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db (DELETE)

  • Description

    Delete a database.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db

  • Parameter

    Parameter

    Description

    :db

    Database name

    ifExists

    If the specified database does not exist, Hive returns an error unless ifExists is set to true.

    option

    Set the parameter to cascade or restrict. If you set it to cascade, all data and definitions are cleared. If you set it to restrict, the table content is empty and the mode does not exist.

  • Return result

    Parameter

    Description

    database

    Name of the deleted database

  • Example
    curl -ik -u : --negotiate -X DELETE 'http://10.64.35.144:9111/templeton/v1/ddl/database/db3?ifExists=true&user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table (GET)

  • Description

    List all tables in the database.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table

  • Parameter

    Parameter

    Description

    :db

    Database name

    like

    Regular expression used to match a table name

  • Return result

    Parameter

    Description

    database

    Database name

    tables

    List of tables in the database

  • Example
    curl -ik -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/ddl/database/default/table?user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table (GET)

  • Description

    Obtain details about a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table?format=extended

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

    format

    Set "format=extended" to view more information about the table. (The function is equivalent to "show table extended like tableName" of HiveQL.)

  • Return result

    Parameter

    Description

    columns

    Column name and type

    database

    Database name

    table

    Table name

    partitioned

    Indicates whether a table is a partition table. This parameter is available only when the table format is extended.

    location

    Table location. This parameter is available only when the table format is extended.

    outputformat

    Output format. This parameter is available only when the table format is extended.

    inputformat

    Input format. This parameter is available only when the table format is extended.

    owner

    Table owner. This parameter is available only when the table format is extended.

    partitionColumns

    Partition column. This parameter is available only when the table format is extended.

  • Example
    curl -ik -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1?format=extended&user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table (PUT)

  • Description

    Create a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    New table name

    group

    User group used for creating the table

    permissions

    Permission used for creating the table

    external

    Allows you to specify a location so that Hive does not use the default location for this table.

    ifNotExists

    If this parameter is set to true, no error is reported if a table exists.

    comment

    Remarks

    columns

    Column description, including the column name, type, and optional remarks.

    partitionedBy

    Partition column description, which is used to partition tables. The columns parameter is used to list the column name, type, and optional remarks.

    clusteredBy

    Bucket column description, including the columnNames, sortedBy, and numberOfBuckets parameters. The columnNames parameter includes the columnName and sorting sequence (ASC indicates an ascending order, and DESC indicates a descending order).

    format

    Storage format. The parameters include rowFormat, storedAs, and storedBy.

    location

    Path in HDFS

    tableProperties

    Table property names and values (name-value pairs)

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

  • Example
    curl -ik -u : --negotiate -X PUT -HContent-type:application/json -d '{"columns": [{"name": "id", "type": "int"}, {"name": "name","type": "string"}], "comment": "hello","format": {"storedAs": "orc"} }' 'http://10.64.35.144:9111/templeton/v1/ddl/database/db3/table/tbl1?user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table (POST)

  • Description

    Rename a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Existing table name

    rename

    New table name

  • Return result

    Parameter

    Description

    database

    Database name

    table

    New table name

  • Example
    curl -ik -u : --negotiate -d rename=table1 'http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/tbl1?user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table (DELETE)

  • Description

    Delete a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

    ifExists

    If this parameter is set to true, no error is reported.

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

  • Example
    curl -ik -u : --negotiate -X DELETE 'http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/table2?ifExists=true&user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:existingtable/like/:newtable (PUT)

  • Description

    Create a table that is the same as an existing table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:existingtable/like/:newtable

  • Parameter

    Parameter

    Description

    :db

    Database name

    :existingtable

    Existing table name

    :newtable

    New table name

    group

    User group used for creating the table

    permissions

    Permission used for creating the table

    external

    Allows you to specify a location so that Hive does not use the default location for this table.

    ifNotExists

    If this parameter is set to true, the Hive does not report an error if a table already exists.

    location

    Path in HDFS

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

  • Example
    curl -ik -u : --negotiate -X PUT -HContent-type:application/json -d '{"ifNotExists": "true"}' 'http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/like/tt1?user.name=user1'
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table/partition(GET)

  • Description

    List information about all partitions of a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/partition

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

    partitions

    List of partition attribute values and partition names

  • Example
    curl -ik -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/x1/partition?user.name=user1
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table/partition/:partition(GET)

  • Description

    List information about a specific partition of a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/partition/:partition

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

    :partition

    Partition name. Exercise caution when decoding HTTP quote, for example, country=%27algeria%27.

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

    partition

    Partition name

    partitioned

    If this parameter is set to true, the table is a partition table.

    location

    Storage path of the table

    outputFormat

    Output format

    columns

    Column name, type, and remarks

    owner

    Owner

    partitionColumns

    Partition column

    inputFormat

    Input format

    totalNumberFiles

    Number of files in a partition

    totalFileSize

    Total size of files in a partition

    maxFileSize

    Maximum file size

    minFileSize

    Minimum file size

    lastAccessTime

    Last access time

    lastUpdateTime

    Last update time

  • Example
    curl -ik -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/x1/partition/dt=1?user.name=user1
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table/partition/:partition(PUT)

  • Description

    Add a table partition.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/partition/:partition

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

    group

    User group used for creating a partition

    permissions

    User permission used for creating a partition

    location

    Storage location of the new partition

    ifNotExists

    If this parameter is set to true, the system reports an error when the partition already exists.

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

    partitions

    Partition name

  • Example
    curl -ik -u : --negotiate -X PUT -HContent-type:application/json -d '{}' http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/x1/partition/dt=10?user.name=user1
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table/partition/:partition(DELETE)

  • Description

    Delete a table partition.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/partition/:partition

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

    group

    User group used for deleting a new partition

    permissions

    User permission used for deleting a new partition. The format is rwxrw-r-x.

    ifExists

    If the specified partition does not exist, the Hive reports an error, unless this parameter is set to true.

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

    partitions

    Partition name

  • Example
    curl -ik -u : --negotiate -X DELETE -HContent-type:application/json -d '{}' http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/x1/partition/dt=10?user.name=user1
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table/column(GET)

  • Description

    Obtain a column list of a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/column

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

    columns

    List of column names and types

  • Example
    curl -ik -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/column?user.name=user1
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table/column/:column(GET)

  • Description

    Obtain details about a column in a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/column/:column

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

    :column

    Column Name

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

    column

    Column name and type

  • Example
    curl -ik -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/column/id?user.name=user1
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table/column/:column(PUT)

  • Description

    Add a column to a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/column/:column

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

    :column

    Column Name

    type

    Column type, for example, string and int.

    comment

    Column remarks, for example, description.

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

    column

    Column name

  • Example
    curl -ik -u : --negotiate -X PUT -HContent-type:application/json -d '{"type": "string", "comment": "new column"}'  http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/column/name?user.name=user1
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table/property(GET)

  • Description

    Obtain properties of a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/property

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

    properties

    List of properties

  • Example
    curl -ik -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/property?user.name=user1
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table/property/:property(GET)

  • Description

    Obtain a specific property value of a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/property/:property

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

    :property

    Property

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

    property

    Property

  • Example
    curl -ik -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/property/last_modified_by?user.name=user1
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

ddl/database/:db/table/:table/property/:property(PUT)

  • Description

    Add a property value to a table.

  • URL

    http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/property/:property

  • Parameter

    Parameter

    Description

    :db

    Database name

    :table

    Table name

    :property

    Property name

    value

    Property value

  • Return result

    Parameter

    Description

    database

    Database name

    table

    Table name

    property

    Property name

  • Example
    curl -ik -u : --negotiate -X PUT -HContent-type:application/json -d '{"value": "my value"}' http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/property/mykey?user.name=user1
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

mapreduce/jar(POST)

  • Description

    Execute a MapReduce job. Before executing a MapReduce job, upload the JAR file of the MapReduce job to HDFS.

  • URL

    http://www.myserver.com/templeton/v1/mapreduce/jar

  • Parameter

    Parameter

    Description

    jar

    JAR file of the MapReduce job to be executed

    class

    Class of the MapReduce job to be executed

    libjars

    JAR file names of classpath to be added, separated by commas (,)

    files

    Names of files to be copied to the MapReduce cluster, separated by commas (,)

    arg

    Input parameter received by the Main class

    define

    This parameter is used to configure Hadoop in the define=NAME=VALUE format.

    statusdir

    WebHCat writes the status of the MapReduce job to statusdir. If this parameter is set, you need to manually delete it.

    enablelog

    If statusdir is set and enablelog is set to true, Hadoop task configurations and logs are collected to $statusdir/logs. Then, successful and failed attempts are recorded in the logs. The layout of the subdirectories in $statusdir/logs is as follows:

    logs/$job_id (directory for $job_id)

    logs/$job_id/job.xml.html

    logs/$job_id/$attempt_id (directory for $attempt_id)

    logs/$job_id/$attempt_id/stderr

    logs/$job_id/$attempt_id/stdout

    logs/$job_id/$attempt_id/syslog

    Only Hadoop 1.X is supported.

    callback

    Callback address after MapReduce job execution. Use $jobId to embed the job ID in the callback address. In the callback address, replace the $jobId with the job ID.

  • Return result

    Parameter

    Description

    id

    Job ID, similar to job_201110132141_0001

  • Example
    curl -ik -u : --negotiate -d jar="/tmp/word.count-0.0.1-SNAPSHOT.jar" -d class=com.huawei.word.count.WD -d statusdir="/output" "http://10.64.35.144:9111/templeton/v1/mapreduce/jar?user.name=user1"
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

mapreduce/streaming(POST)

  • Description

    Submit a MapReduce job in Streaming mode.

  • URL

    http://www.myserver.com/templeton/v1/mapreduce/streaming

  • Parameter

    Parameter

    Description

    input

    Input path of Hadoop

    output

    Output save path. If this parameter is not specified, WebChat will store the output in a path that can be found by using queue resources.

    mapper

    Location of the mapper program

    reducer

    Location of the reducer program

    files

    Add HDFS files to the distributed cache.

    arg

    Set argument.

    define

    Set Hadoop configuration variables in the define=NAME=VALUE format.

    cmdenv

    Set environment variables in the cmdenv=NAME=VALUE format.

    statusdir

    WebHCat writes the status of the MapReduce job to statusdir. If this parameter is set, you need to manually delete it.

    enablelog

    If statusdir is set and enablelog is set to true, Hadoop task configurations and logs are collected to $statusdir/logs. Then, successful and failed attempts are recorded in the logs. The layout of the subdirectories in $statusdir/logs is as follows:

    logs/$job_id (directory for $job_id)

    logs/$job_id/job.xml.html

    logs/$job_id/$attempt_id (directory for $attempt_id)

    logs/$job_id/$attempt_id/stderr

    logs/$job_id/$attempt_id/stdout

    logs/$job_id/$attempt_id/syslog

    Only Hadoop 1.X is supported.

    callback

    Callback address after MapReduce job execution. Use $jobId to embed the job ID in the callback address. In the callback address, replace the $jobId with the job ID.

  • Return result

    Parameter

    Description

    id

    Job ID, similar to job_201110132141_0001

  • Example
    curl -i -u : --negotiate -d input=/input -d output=/oooo -d mapper=/bin/cat -d reducer="/usr/bin/wc -w" -d statusdir="/output" 'http://10.64.35.144:50111/templeton/v1/mapreduce/streaming?user.name=user1'
  • Before using this API, ensure that the prerequisites are met. For details, see Rules.
  • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
  • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.

/hive(POST)

  • Description

    Run Hive commands.

  • URL

    http://www.myserver.com/templeton/v1/hive

  • Parameter

    Parameter

    Description

    execute

    Hive commands, including entire and short Hive commands

    file

    HDFS file containing Hive commands

    files

    Names of files to be copied to the MapReduce cluster, separated by commas (,)

    arg

    Set argument.

    define

    This parameter is used to configure Hadoop in the define=key=value format.

    statusdir

    WebHCat writes the status of the MapReduce job to statusdir. If this parameter is set, you need to manually delete it.

    enablelog

    If statusdir is set and enablelog is set to true, Hadoop task configurations and logs are collected to $statusdir/logs. Then, successful and failed attempts are recorded in the logs. The layout of the subdirectories in $statusdir/logs is as follows:

    logs/$job_id (directory for $job_id)

    logs/$job_id/job.xml.html

    logs/$job_id/$attempt_id (directory for $attempt_id)

    logs/$job_id/$attempt_id/stderr

    logs/$job_id/$attempt_id/stdout

    logs/$job_id/$attempt_id/syslog

    callback

    Callback address after MapReduce job execution. Use $jobId to embed the job ID in the callback address. In the callback address, replace the $jobId with the job ID.

  • Return result

    Parameter

    Description

    id

    Job ID, similar to job_201110132141_0001

  • Example
    curl -ik -u : --negotiate -d execute="select count(*) from t1" -d statusdir="/output" "http://10.64.35.144:9111/templeton/v1/hive?user.name=user1"
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

jobs(GET)

  • Description

    Obtain all job IDs.

  • URL

    http://www.myserver.com/templeton/v1/jobs

  • Parameter

    Parameter

    Description

    fields

    If this parameter is set to *, details about each job are returned. If this parameter is not set, only a job ID is returned. The parameter can only be set to *. If the parameter is set to another value, an exception occurs.

    jobid

    If jobid is set, only jobs whose lexicographic order is greater than jobid are returned. For example, if the value of jobid is job_201312091733_0001, only the job whose value is greater than the value can be returned. The number of returned jobs depends on the value of numrecords.

    numrecords

    If numrecords and jobid are set, the jobid list is sorted lexicographically. After jobid is returned, the maximum value of numrecords can be obtained. If jobid is not set but numrecords is set, the maximum value of numrecords can be obtained after the jobid list is sorted lexicographically. In contrast, if numrecords is not set but jobid is set, all jobs whose lexicographic orders are greater than jobid will be returned.

    showall

    If this parameter is set to true, all jobs can be obtained. If this parameter is set to false, only jobs submitted by the current user can be obtained. The default value is false.

  • Return result

    Parameter

    Description

    id

    Job id

    detail

    If the value of showall is true, details are displayed. Otherwise, the value is null.

  • Example
    curl -ik -u : --negotiate  "http://10.64.35.144:9111/templeton/v1/jobs?user.name=user1"
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

jobs/:jobid(GET)

  • Description

    Obtain information about a specified job.

  • URL

    http://www.myserver.com/templeton/v1/jobs/:jobid

  • Parameter

    Parameter

    Description

    jobid

    Job ID, received after a job is created

  • Return result

    Parameter

    Description

    status

    JSON object containing job status information

    profile

    JSON object containing job information WebHCat parses information in the JobProfile object. The object varies according to the Hadoop version.

    id

    Job ID

    percentComplete

    Job completion percentage, for example, 75%. If the job is complete, the value is null.

    user

    User who created the job

    callback

    Callback URL (if any)

    userargs

    Parameter argument and parameter value when a user submits a job

    exitValue

    Exit value of the job

  • Example
    curl -ik -u : --negotiate  "http://10.64.35.144:9111/templeton/v1/jobs/job_1440386556001_0255?user.name=user1"
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In MRS 1.9.2 or later, the default port number is 9111. For details, see templeton.port in Services > Hive > Service Configuration on the MRS Manager management page.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.

jobs/:jobid(DELETE)

  • Description

    Kill a job.

  • URL

    http://www.myserver.com/templeton/v1/jobs/:jobid

  • Parameter

    Parameter

    Description

    :jobid

    ID of the job to be deleted

  • Return result

    Parameter

    Description

    user

    User who submits a job

    status

    JSON object containing job status information

    profile

    JSON object containing job information WebHCat parses information in the JobProfile object. The object varies according to the Hadoop version.

    id

    Job ID

    callback

    Callback URL (if any)

  • Example
    curl -ik -u : --negotiate -X DELETE  "http://10.64.35.143:9111/templeton/v1/jobs/job_1440386556001_0265?user.name=user1"
    • The example uses the service IP address of WebHCat node and the WebHCat port configured during the installation as an example.
    • In this example, http is used for a common cluster and https is used for a security cluster. For details, see templeton.protocol.type in Services > Hive > Service Configuration on the MRS Manager management page.