WebHCat
- The following uses the service IP address of WebHCat and the WebHCat HTTP port configured during the installation as an example.
- The user.name parameter needs to be added to APIs except :version, status, version, version/hive, and version/hadoop.
- :version(GET)
- Description
- URL
- Parameter
Parameter
Description
:version
WebHCat version number (Currently this must be v1.)
- Returned result
Parameter
Description
responseTypes
A list of all supported response types
- Example
curl -i -u : --negotiate 'http://10.64.35.144:9111/templeton/v1'
- status (GET)
- Description
- URL
- Parameter
- Returned result
Parameter
Description
status
OK is returned if the WebHCat server was contacted.
version
String containing the version number similar to "v1"
- Example
curl -i -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/status'
- version (GET)
- Description
- URL
- Parameter
- Returned result
Parameter
Description
supportedVersions
A list of all supported versions
version
The current version
- Example
curl -i -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/version'
- version/hive (GET)
- Description
- URL
- Parameter
- Returned result
Parameter
Description
module
hive
version
Hive version
- Example
curl -i -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/version/hive'
- version/hadoop (GET)
- Description
- URL
- Parameter
- Returned result
Parameter
Description
module
hadoop
version
Hadoop version
- Example
curl -i -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/version/hadoop'
- ddl (POST)
- Description
- URL
- Parameter
Parameter
Description
exec
The HCatalog ddl string to execute
group
The user group to use when creating a table
permissions
The permissions string to use when creating a table. The format is "rwxrw-r-x".
- Returned result
Parameter
Description
stdout
A string containing the result HCatalog sent to standard out (possibly empty)
stderr
A string containing the result HCatalog sent to standard error (possibly empty)
exitcode
The exitcode HCatalog returned
- Example
curl -i -u : --negotiate -d exec="show tables" 'http://10.64.35.144:9111/templeton/v1/ddl?user.name=user1'
- ddl/database (GET)
- Description
- URL
- Parameter
Parameter
Description
like
List only databases whose names match the specified pattern.
- Returned result
Parameter
Description
databases
A list of database names
- Example
curl -i -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/ddl/database?user.name=user1'
- ddl/database/:db (GET)
- Description
- URL
- Parameter
Parameter
Description
:db
The database name
- Returned result
Parameter
Description
location
The database location
comment
The database comment. If there is no database comment, the value is null.
database
The database name
owner
The database owner
owertype
The type of the database owner
- Example
curl -i -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/ddl/database/default?user.name=user1'
- ddl/database/:db (PUT)
- Description
- URL
- Parameter
Parameter
Description
:db
The database name
group
The user group to use
permission
The permissions string to use
location
The database location
comment
A comment for the database, like a description
properties
The database properties
- Returned result
Parameter
Description
database
The database name
- Example
curl -i -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'
- ddl/database/:db (DELETE)
- Description
- URL
- Parameter
Parameter
Description
:db
The database name
ifExists
Hive returns an error if the database specified does not exist, unless ifExists is set to true.
option
Parameter set to either cascade or restrict. restrict will remove the schema if all the tables are empty. cascade removes everything including data and definitions.
- Returned result
Parameter
Description
database
The database name
- Example
curl -i -u : --negotiate -X DELETE 'http://10.64.35.144:9111/templeton/v1/ddl/database/db3?ifExists=true?user.name=user1'
- ddl/database/:db/table (GET)
- Description
- URL
- Parameter
Parameter
Description
:db
The database name
like
List only tables whose names match the specified pattern.
- Returned result
Parameter
Description
database
A list of table names
tables
The database name
- Example
curl -i -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/ddl/database/default/table?user.name=user1'
- ddl/database/:db/table/:table (GET)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table
- Parameter
Parameter
Description
:db
The database name
:table
The table name
format
Set "format=extended" to see additional information (using "show table extended like").
- Returned result
Parameter
Description
columns
A list of column names and types
database
The database name
table
The table name
partitioned
Indicates whether a table is a partition table. This parameter is available only when the table format is extended.
location
Location of a table. 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
Owner of a table. 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 -i -u : --negotiate 'http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1?format=extended&user.name=user1'
- ddl/database/:db/table/:table (PUT)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table
- Parameter
Parameter
Description
:db
The database name
:table
The new table name
group
The user group to use when creating a table
permissions
The permissions string to use when creating a table
external
Allows you to specify a location so that Hive does not use the default location for this table.
ifNotExists
If the value true, you will not receive an error if the table already exists.
comment
Comment for the table
columns
A list of column descriptions, including name, type, and an optional comment
partitionedBy
A list of column descriptions used to partition the table. Like the columns parameter this is a list of name, type, and comment fie.
clusteredBy
Bucket column description, including the columnNames, sortedBy, and numberOfBuckets parameters. The columnNames parameter includes columnName and sorting sequence (ASC for ascending or DESC for descending).
format
Storage format description including parameters for rowFormat, storedAs, and storedBy.
location
The HDFS path
tableProperties
A list of table property names and values (key/value pairs).
- Returned result
Parameter
Description
database
The new table name
table
The database name
- Example
curl -i -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'
- ddl/database/:db/table/:table (POST)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table
- Parameter
Parameter
Description
:db
The database name
:table
The existing (old) table name
rename
The new table name
- Returned result
Parameter
Description
database
The database name
table
The new table name
- Example
curl -i -u : --negotiate -d rename=table1 'http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/tbl1?user.name=user1'
- ddl/database/:db/table/:table (DELETE)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table
- Parameter
Parameter
Description
:db
The database name
:table
The table name
ifExists
If the value is true, you will not receive an error.
- Returned result
Parameter
Description
database
The database name
table
The table name
- Example
curl -i -u : --negotiate -X DELETE 'http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/table2?ifExists=true&user.name=user1'
- ddl/database/:db/table/:existingtable/like/:newtable (PUT)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:existingtable/like/:newtable
- Parameter
Parameter
Description
:db
The database name
:existingtable
The existing table name
:newtable
The new table name
group
The user group to use when creating a table
permissions
The permissions string to use when creating a table
external
Allows you to specify a location so that Hive does not use the default location for this table.
ifNotExists
If the value is true, you will not receive an error if the table already exists.
location
The HDFS path
- Returned result
Parameter
Description
database
The database name
table
The new table name
- Example
curl -i -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'
- ddl/database/:db/table/:table/partition(GET)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/partition
- Parameter
Parameter
Description
:db
The database name
:table
The table name
- Returned result
Parameter
Description
database
The database name
table
The table name
partitions
A list of partition values and of partition names
- Example
curl -i -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/x1/partition?user.name=user1
- ddl/database/:db/table/:table/partition/:partition(GET)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/partition/:partition
- Parameter
Parameter
Description
:db
The database name
:table
The table name
:partition
The partition name, col_name='value' list. Be careful to properly encode the quote for http, for example, "country=%27algeria%27".
- Returned result
Parameter
Description
database
The database name
table
The table name
partition
The partition name
partitioned
True if the table is partitioned
location
Location of table
outputFormat
Output format
columns
List of column names, types, and comments
owner
The owner's user name
partitionColumns
List of the partition columns
inputFormat
Input format
totalNumberFiles
Number of files in a partition
totalFileSize
Total file size in a partition
maxFileSize
Maximum file size
minFileSize
Minimum file size
lastAccessTime
Last access time
lastUpdateTime
Last update time
- Example
curl -i -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/x1/partition/dt=1?user.name=user1
- ddl/database/:db/table/:table/partition/:partition(PUT)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/partition/:partition
- Parameter
Parameter
Description
:db
The database name
:table
The table name
group
The user group to use
permissions
The permissions string to use
location
The location for partition creation
ifNotExists
If the value is true, return an error if the partition already exists.
- Returned result
Parameter
Description
database
The database name
table
The table name
partitions
The partition name
- Example
curl -i -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
- ddl/database/:db/table/:table/partition/:partition(DELETE)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/partition/:partition
- Parameter
Parameter
Description
:db
The database name
:table
The table name
group
The user group to use
permissions
The permissions string to use. The format is "rwxrw-r-x".
ifExists
Hive returns an error if the partition specified does not exist, unless ifExists is set to true.
- Returned result
Parameter
Description
database
The database name
table
The table name
partitions
The partition name
- Example
curl -i -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
- ddl/database/:db/table/:table/column(GET)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/column
- Parameter
Parameter
Description
:db
The database name
:table
The table name
- Returned result
Parameter
Description
database
The database name
table
The table name
columns
A list of column names and types
- Example
curl -i -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/column?user.name=user1
- ddl/database/:db/table/:table/column/:column(GET)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/column/:column
- Parameter
Parameter
Description
:db
The database name
:table
The table name
:column
The column name
- Returned result
Parameter
Description
database
The database name
table
The table name
column
Column name and type
- Example
curl -i -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/column/id?user.name=user1
- ddl/database/:db/table/:table/column/:column(PUT)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/column/:column
- Parameter
Parameter
Description
:db
The database name
:table
The table name
:column
The column name
type
The type of column to add, like "string" or "int"
comment
The column comment, like a description
- Returned result
Parameter
Description
database
The database name
table
The table name
column
The column name
- Example
curl -i -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
- ddl/database/:db/table/:table/property(GET)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/property
- Parameter
Parameter
Description
:db
The database name
:table
The table name
- Returned result
Parameter
Description
database
The database name
table
The table name
properties
Property list
- Example
curl -i -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/property?user.name=user1
- ddl/database/:db/table/:table/property/:property(GET)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/property/:property
- Parameter
Parameter
Description
:db
The database name
:table
The table name
:property
The property name
- Returned result
Parameter
Description
database
The database name
table
The table name
property
Property list
- Example
curl -i -u : --negotiate http://10.64.35.144:9111/templeton/v1/ddl/database/default/table/t1/property/last_modified_by?user.name=user1
- ddl/database/:db/table/:table/property/:property(PUT)
- Description
- URL
http://www.myserver.com/templeton/v1/ddl/database/:db/table/:table/property/:property
- Parameter
Parameter
Description
:db
The database name
:table
The table name
:property
The property name
value
The property value
- Returned result
Parameter
Description
database
The database name
table
The table name
property
The property name
- Example
curl -i -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
- mapreduce/jar(POST)
- Description
Execute an MR task. Before the execution, upload MR JAR packages to HDFS.
- URL
- Parameter
Parameter
Description
jar
Name of the jar file for Map Reduce to use
class
Name of the class for Map Reduce to use
libjars
Comma-separated jar files to include in the classpath
files
Comma-separated files to be copied to the map reduce cluster
arg
Main class input parameter
define
Set a Hadoop configuration variable using the syntax define=NAME=VALUE.
statusdir
A directory where WebHCat will write the status of the Map Reduce job. If provided, it is the caller's responsibility to remove this directory when done.
enablelog
If statusdir is set and enablelog is true, collect Hadoop job configuration and logs in to a directory named $statusdir/logs after the job finishes. Both completed and failed attempts are logged. The layout of subdirectories in $statusdir/logs is:
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
This parameter supports only Hadoop 1.X.
callback
Define a URL to be called upon job completion. You may embed a specific job ID into this URL using $jobId. This tag will be replaced in the callback URL with this job's job ID.
- Returned result
Parameter
Description
id
A string containing the job ID similar to "job_201110132141_0001"
- Example
curl -i -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:210559111/templeton/v1/mapreduce/jar?user.name=user1"
- Description
- mapreduce/streaming(POST)
- Description
- URL
- Parameter
Parameter
Description
input
Location of the input data in Hadoop
output
Location in which to store the output data. If not specified, WebHCat will store the output in a location that can be discovered using the queue resource.
mapper
Location of the mapper program in Hadoop
reducer
Location of the reducer program in Hadoop
files
Add an HDFS file to the distributed cache.
arg
Set a program argument.
define
Set a Hadoop configuration variable using the syntax define=NAME=VALUE.
cmdenv
Set an environment variable using the syntax cmdenv=NAME=VALUE.
statusdir
A directory where WebHCat will write the status of the Map Reduce job. If provided, it is the caller's responsibility to remove this directory when done.
enablelog
If statusdir is set and enablelog is true, collect Hadoop job configuration and logs in to a directory named $statusdir/logs after the job finishes. Both completed and failed attempts are logged. The layout of subdirectories in $statusdir/logs is:
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
This parameter supports only Hadoop 1.X.
callback
Define a URL to be called upon job completion. You may embed a specific job ID into this URL using $jobId. This tag will be replaced in the callback URL with this job's job ID.
- Returned result
Parameter
Description
id
A string containing the 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:9111/templeton/v1/mapreduce/streaming?user.name=user1'
For details about prerequisites for using this interface, see the Hive rule in the Development Specifications.
- /hive(POST)
- Description
- URL
- Parameter
Parameter
Description
execute
String containing an entire, short Hive program to run
file
HDFS file name of a Hive program to run
files
Comma-separated files to be copied to the map reduce cluster
arg
Set a program argument.
define
Hive configuration. The format is define=key=value. If multiple instances are used, you need to configure the scratch dir for them. For example, the WebHCat instance uses define=hive.exec.scratchdir=/tmp/hive-scratch. The WebHCat1 instance uses define=hive.exec.scratchdir=/tmp/hive1-scratch. The same rule applies to other instances.
statusdir
A directory where WebHCat will write the status of the Hive job. If provided, it is the caller's responsibility to remove this directory when done.
enablelog
If statusdir is set and enablelog is true, collect Hadoop job configuration and logs in to a directory named $statusdir/logs after the job finishes. Both completed and failed attempts are logged. The layout of subdirectories in $statusdir/logs is:
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
This parameter supports only Hadoop 1.X.
callback
Define a URL to be called upon job completion. You may embed a specific job ID into this URL using $jobId. This tag will be replaced in the callback URL with this job's job ID.
- Returned result
Parameter
Description
id
A string containing the job ID similar to "job_201110132141_0001"
- Example
curl -i -u : --negotiate -d execute="select count(*) from t1" -d statusdir="/output" -d define=hive.exec.scratchdir=/tmp/hive-scratch "http://10.64.35.144:9111/templeton/v1/hive?user.name=user1"
- jobs(GET)
- Indicates
- URL
- Parameter
Parameter
Description
fields
If fields set to *, the request will return full details of the job. If fields is missing, will only return the job ID. Currently the value can only be *, other values are not allowed and will throw exception.
jobid
If jobid is present, only the records whose job ID is lexicographically greater than jobid are returned. For example, if jobid = "job_201312091733_0001", the jobs whose job ID is greater than "job_201312091733_0001" are returned. The number of records returned depends on the value of numrecords.
numrecords
If the jobid and numrecords parameters are present, the top numrecords records appearing after jobid will be returned after sorting the job ID list lexicographically. If the jobid parameter is missing and numrecords is present, the top numrecords will be returned after lexicographically sorting the job ID list. If the jobid parameter is present and numrecords is missing, all the records whose job ID is greater than jobid are 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. This parameter is set to false by default.
- Returned result
Parameter
Description
id
Job id
detail
Job details if showall is set to true; otherwise null.
- Example
curl -i -u : --negotiate "http://10.64.35.144:9111/templeton/v1/jobs?user.name=user1"
- jobs/:jobid(GET)
- Indicates
- URL
- Parameter
Parameter
Description
jobid
The job ID to check. This is the ID received when the job was created.
- Returned result
Parameter
Description
status
A JSON object containing the job status information
profile
A JSON object containing the job profile information. WebHCat passes along the information in the JobProfile object, which is subject to change from one Hadoop version to another.
id
The job ID
percentComplete
The job completion percentage, for example "75% complete". If the job is completed, the value is null.
user
User name of the job creator
callback
The callback URL, if any
userargs
A JSON object representing the argument names and values for the job submission request
exitValue
The job's exit value
- Example
curl -i -u : --negotiate "http://10.64.35.144:9111/templeton/v1/jobs/job_1440386556001_0255?user.name=user1"
- jobs/:jobid(DELETE)
- Indicates
- URL
- Parameter
Parameter
Description
jobid
The job ID to delete. This is the ID received when the job was created.
- Returned result
Parameter
Description
user
Indicates the user that submits jobs.
status
A JSON object containing the job status information
profile
A JSON object containing the job profile information. WebHCat passes along the information in the JobProfile object, which is subject to change from one Hadoop version to another.
id
The job ID
callback
The callback URL, if any
- Example
curl -i -u : --negotiate -X DELETE "http://10.64.35.143:9111/templeton/v1/jobs/job_1440386556001_0265?user.name=user1"
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot