测试 jupyter notebook rest api

创建目录
Method:POST
URL:http://localhost:8888/api/contents
Body/raw: {"type":"directory"}
Response:
{
"created": "2017-09-29T02:27:48.277551Z",
"type": "directory",
"name": "Untitled Folder 2",
"mimetype": null,
"content": null,
"path": "Untitled Folder 2",
"last_modified": "2017-09-29T02:27:48.277551Z",
"format": null,
"writable": true
}

重命名目录
目录的名字可以用特殊字符,比如 【】
Method:PATCH
URL:http://localhost:8888/api/contents/Untitled Folder 2
Body/raw: {"path": "my_folder"}
Response:
{
"created": "2017-09-29T02:32:58.825560Z",
"type": "directory",
"name": "my_folder",
"mimetype": null,
"content": null,
"path": "my_folder",
"last_modified": "2017-09-29T02:32:13.525558Z",
"format": null,
"writable": true
}

删除目录
删除之前,目录不能有文件
Method:DELETE
URL:http://localhost:8888/api/contents/my_folder
Response:204 No Content

创建notebook
Method:POST
URL:http://localhost:8888/api/contents
Body/raw: {"type":"notebook"}
Response:
{
"created": "2017-09-29T02:29:44.445554Z",
"type": "notebook",
"name": "Untitled12.ipynb",
"mimetype": null,
"content": null,
"path": "Untitled12.ipynb",
"last_modified": "2017-09-29T02:29:44.445554Z",
"format": null,
"writable": true
}

重命名notebook
Untitled12.ipynb需存在,11111.ipynb是新文件名
Method:PATCH
URL:http://localhost:8888/api/contents/Untitled12.ipynb
Body/raw: {"path": "11111.ipynb"}
Response:
{
"created": "2017-09-29T02:18:02.593534Z",
"type": "notebook",
"name": "11111.ipynb",
"mimetype": null,
"content": null,
"path": "11111.ipynb",
"last_modified": "2017-09-29T01:37:07.721463Z",
"format": null,
"writable": true
}

删除notebook
Method:DELETE
URL:http://localhost:8888/api/contents/11111.ipynb
Response:204 No Content

原文地址:https://www.cnblogs.com/machong/p/7611562.html