[
https://issues.apache.org/jira/browse/HDFS-13870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Siyao Meng updated HDFS-13870:
------------------------------
Description:
Adding ALLOWSNAPSHOT and DISALLOWSNAPSHOT (since 2.8.0, HDFS-9057) to WebHDFS
REST API
[doc|https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/WebHDFS.html].
Below are my examples of the APIs:
{code:bash}
# ALLOWSNAPSHOT uses http method PUT.
curl -X "PUT"
"http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=ALLOWSNAPSHOT&user.name=hdfs"
Response on success:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{code}
{code:bash}
# DISALLOWSNAPSHOT uses http method PUT.
curl -X "PUT"
"http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=DISALLOWSNAPSHOT&user.name=hdfs"
Response on success:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{code}
Note: GETSNAPSHOTDIFF and GETSNAPSHOTTABLEDIRECTORYLIST are already documented.
{code:bash}
# GETSNAPSHOTDIFF uses GET.
curl
"http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=GETSNAPSHOTDIFF&user.name=hdfs&oldsnapshotname=snap1&snapshotname=snap2"
Response on success (example):
HTTP/1.1 200 OK
Content-Type: application/json
{"SnapshotDiffReport":{"diffList":[{"sourcePath":"","type":"MODIFY"},{"sourcePath":"newfile.txt","type":"CREATE"}],"fromSnapshot":"snapOld","snapshotRoot":"/snaptest","toSnapshot":"snapNew"}}
{code}
{code:bash}
# GETSNAPSHOTTABLEDIRECTORYLIST uses GET.
curl
"http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=GETSNAPSHOTTABLEDIRECTORYLIST&user.name=hdfs"
Response on success (example):
HTTP/1.1 200 OK
Content-Type: application/json
{"SnapshottableDirectoryList":[{"dirStatus":{"accessTime":0,"blockSize":0,"childrenNum":0,"fileId":16392,"group":"supergroup","length":0,"modificationTime":1535151813500,"owner":"hdfs","pathSuffix":"snaptest","permission":"755","replication":0,"storagePolicy":0,"type":"DIRECTORY"},"parentFullPath":"/","snapshotNumber":2,"snapshotQuota":65536}]}
{code}
was:
ALLOWSNAPSHOT, DISALLOWSNAPSHOT (since 2.8.0, HDFS-9057),
GETSNAPSHOTDIFF (since 3.0.3, HDFS-13052), GETSNAPSHOTTABLEDIRECTORYLIST
(HDFS-13141) don't have their API usage documentation in the [official
doc|https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/WebHDFS.html]
yet.
Below are my examples of those undocumented APIs:
{code:bash}
# ALLOWSNAPSHOT uses http method PUT.
curl -X "PUT"
"http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=ALLOWSNAPSHOT&user.name=hdfs"
Response on success:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{code}
{code:bash}
# DISALLOWSNAPSHOT uses http method PUT.
curl -X "PUT"
"http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=DISALLOWSNAPSHOT&user.name=hdfs"
Response on success:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
{code}
{code:bash}
# GETSNAPSHOTDIFF uses GET.
curl
"http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=GETSNAPSHOTDIFF&user.name=hdfs&oldsnapshotname=snap1&snapshotname=snap2"
Response on success (example):
HTTP/1.1 200 OK
Content-Type: application/json
{"SnapshotDiffReport":{"diffList":[{"sourcePath":"","type":"MODIFY"},{"sourcePath":"newfile.txt","type":"CREATE"}],"fromSnapshot":"snapOld","snapshotRoot":"/snaptest","toSnapshot":"snapNew"}}
{code}
{code:bash}
# GETSNAPSHOTTABLEDIRECTORYLIST uses GET.
curl
"http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=GETSNAPSHOTTABLEDIRECTORYLIST&user.name=hdfs"
Response on success (example):
HTTP/1.1 200 OK
Content-Type: application/json
{"SnapshottableDirectoryList":[{"dirStatus":{"accessTime":0,"blockSize":0,"childrenNum":0,"fileId":16392,"group":"supergroup","length":0,"modificationTime":1535151813500,"owner":"hdfs","pathSuffix":"snaptest","permission":"755","replication":0,"storagePolicy":0,"type":"DIRECTORY"},"parentFullPath":"/","snapshotNumber":2,"snapshotQuota":65536}]}
{code}
> WebHDFS: Document ALLOWSNAPSHOT and DISALLOWSNAPSHOT
> ----------------------------------------------------
>
> Key: HDFS-13870
> URL: https://issues.apache.org/jira/browse/HDFS-13870
> Project: Hadoop HDFS
> Issue Type: Task
> Components: documentation, webhdfs
> Reporter: Siyao Meng
> Assignee: Siyao Meng
> Priority: Minor
>
> Adding ALLOWSNAPSHOT and DISALLOWSNAPSHOT (since 2.8.0, HDFS-9057) to WebHDFS
> REST API
> [doc|https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/WebHDFS.html].
> Below are my examples of the APIs:
> {code:bash}
> # ALLOWSNAPSHOT uses http method PUT.
> curl -X "PUT"
> "http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=ALLOWSNAPSHOT&user.name=hdfs"
> Response on success:
> HTTP/1.1 200 OK
> Content-Type: application/octet-stream
> {code}
> {code:bash}
> # DISALLOWSNAPSHOT uses http method PUT.
> curl -X "PUT"
> "http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=DISALLOWSNAPSHOT&user.name=hdfs"
> Response on success:
> HTTP/1.1 200 OK
> Content-Type: application/octet-stream
> {code}
> Note: GETSNAPSHOTDIFF and GETSNAPSHOTTABLEDIRECTORYLIST are already
> documented.
> {code:bash}
> # GETSNAPSHOTDIFF uses GET.
> curl
> "http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=GETSNAPSHOTDIFF&user.name=hdfs&oldsnapshotname=snap1&snapshotname=snap2"
> Response on success (example):
> HTTP/1.1 200 OK
> Content-Type: application/json
> {"SnapshotDiffReport":{"diffList":[{"sourcePath":"","type":"MODIFY"},{"sourcePath":"newfile.txt","type":"CREATE"}],"fromSnapshot":"snapOld","snapshotRoot":"/snaptest","toSnapshot":"snapNew"}}
> {code}
> {code:bash}
> # GETSNAPSHOTTABLEDIRECTORYLIST uses GET.
> curl
> "http://<SERVER>:<PORT>/webhdfs/v1/snaptest/?op=GETSNAPSHOTTABLEDIRECTORYLIST&user.name=hdfs"
> Response on success (example):
> HTTP/1.1 200 OK
> Content-Type: application/json
> {"SnapshottableDirectoryList":[{"dirStatus":{"accessTime":0,"blockSize":0,"childrenNum":0,"fileId":16392,"group":"supergroup","length":0,"modificationTime":1535151813500,"owner":"hdfs","pathSuffix":"snaptest","permission":"755","replication":0,"storagePolicy":0,"type":"DIRECTORY"},"parentFullPath":"/","snapshotNumber":2,"snapshotQuota":65536}]}
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]