Ah, I see - it's coming from a different server. In that case, you'll need
to do something like this:

// Valid notebook JSON - see
http://nbformat.readthedocs.io/en/latest/format_description.html
var nb_json = {"nbformat": 4, ...}
var model = {type: "notebook", content: nb_json}
Jupyter.contents.save("folder/filename.ipynb", model).then(function() {
    console.log("Saved notebook");
})

I haven't tested this, so it might need tweaking a bit.

Thomas

On 11 December 2017 at 16:54, <[email protected]> wrote:

> Hi,
>
> By the server, I meant a server which is running on an AWS lambda. The
> functionality that I want is to create a notebook using the json which I
> have received from the server. Think of it as a function which is used to
> create a new empty notebook. But in my case, I would like to create a
> notebook with a pre-filled notebook json I have.
>
> Is that making sense?
>
> Best,
> Anant
>
> On Monday, December 11, 2017 at 11:38:01 AM UTC-5, takowl wrote:
>>
>> It's probably easiest to create a file on the server side, then you just
>> need to open a window with the right URL to view it.
>>
>> To do this from the Javascript side, you'd need to get the data from the
>> server and then send it straight back to be saved to a file.
>>
>> On 11 December 2017 at 16:01, <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I am working on this tree extension, which puts a button on the toolbar
>>> (see the attached file). On clicking the button, I fetch a notebook
>>> json from a server and store it in a javascript variable. I would like to
>>> create and open the notebook using the json received for the user to start
>>> working on.
>>>
>>> I am aware of the working in the contents.js file in the services
>>> folder, but not sure how I can create a file using what's available.
>>>
>>> Best,
>>> Anant
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Project Jupyter" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/jupyter/b3330376-582d-4e90-9933-b5d740fbf8f4%40googlegroups.com
>>> <https://groups.google.com/d/msgid/jupyter/b3330376-582d-4e90-9933-b5d740fbf8f4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jupyter/268e847c-726c-46fa-a548-56661760dc4e%40googlegroups.com
> <https://groups.google.com/d/msgid/jupyter/268e847c-726c-46fa-a548-56661760dc4e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAOvn4qi6px_Z2feUiOe0QJ2fCJLLo_zq47-yk0NjHEgHz6xO4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to