How to save Jupyter notebook via API?

Good day!

Is it possible to achieve “File” -> “Save and Checkpoint” programmatically?

I know there is JS command, but it has no callback and so I can’t be sure that file is actually saved.

I also found “Save file” section in Jupyter APIs:

Tried without success:

import requests
response = requests.request(
method=‘PUT’,
url=‘http://127.0.0.1:8888/api/contents/my-notebook.ipynb’,
headers={‘Authorization’: ‘token 6ec2282d28e6e755629e9007787299a929a0154e54c59df7’},
)
print(response.status_code)
print(response.json())

Don’t you know is it possible to achieve this?

This is helpful.
https://jupyter-notebook.readthedocs.io/en/stable/extending/contents.html

Maybe some error in your put data. put data is content which will be used in ContentManager.