# Saving data to Pavlovia server

**URL:** <https://discourse.psychopy.org/t/saving-data-to-pavlovia-server/12408>\
**Category:** Online experiments\
**Created:** [April 15, 2020, 1:32pm UTC](https://discourse.psychopy.org/t/saving-data-to-pavlovia-server/12408 "2020-04-15T13:32:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![attentionperception](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@attentionperception](https://discourse.psychopy.org/u/attentionperception)\
**Post date:** [April 15, 2020, 1:32pm UTC](https://discourse.psychopy.org/t/saving-data-to-pavlovia-server/12408/1 "2020-04-15T13:32:29Z")

</div>

My experiment is not written in PsychoPy due to problems I had with the builder and my specific needs, but I don’t know where else to ask. Sorry if this is irrelevant, but I hope somebody can help me.

My code collects participant demographics and stores it in a Javascript object, which can be converted to JSON.  
My code also collects data for each trial as an object, which is put in an array that is appended each trial. This can also be converted to JSON

My question is, how do I save this information to the data folder of my Gitlab at the end of the experiment?  
Is there simple code I can implement for this?  
Or do I need to implement PsychoJS into my code? If so, is that possible without converting my whole project to PsychoJS?

Any help would be greatly appreciated. If more information is needed, please let me know.  
Thanks!

Example JSON of participant info:  
“{“initials”:“EMR”,“age”:“24”,“gender”:“F”,“percent mammo”:“25”,“years experience”:“12”,“cases per year”:“1400”,“screen size”:68.58,“image\_pixels”:562}”

Example JSON of participant data:  
“[{“block”:“F0/”,“trialnum”:1,“imagenum”:“N63”,“rating”:77,“rt”:2015},{“block”:“F0/”,“trialnum”:2,“imagenum”:“AC1”,“rating”:15,“rt”:1007},{“block”:“F0/”,“trialnum”:3,“imagenum”:“AP3”,“rating”:91,“rt”:899},{“block”:“F1/”,“trialnum”:1,“imagenum”:“N1”,“rating”:26,“rt”:702},{“block”:“F1/”,“trialnum”:2,“imagenum”:“N2”,“rating”:84,“rt”:570},{“block”:“F1/”,“trialnum”:3,“imagenum”:“AC1”,“rating”:66,“rt”:1001},{“block”:“F1/”,“trialnum”:4,“imagenum”:“AP1”,“rating”:10,“rt”:1267},{“block”:“F1/”,“trialnum”:5,“imagenum”:“AC2”,“rating”:95,“rt”:731},{“block”:“F1/”,“trialnum”:6,“imagenum”:“AP2”,“rating”:2,“rt”:1131},{“block”:“F1/”,“trialnum”:7,“imagenum”:“AD1”,“rating”:99,“rt”:1009},{“block”:“F1/”,“trialnum”:8,“imagenum”:“AD2”,“rating”:12,“rt”:738},{“block”:“F2/”,“trialnum”:1,“imagenum”:“AC1”,“rating”:86,“rt”:958},{“block”:“F2/”,“trialnum”:2,“imagenum”:“AP1”,“rating”:79,“rt”:850},{“block”:“F2/”,“trialnum”:3,“imagenum”:“N2”,“rating”:61,“rt”:658},{“block”:“F2/”,“trialnum”:4,“imagenum”:“AD2”,“rating”:85,“rt”:625},{“block”:“F2/”,“trialnum”:5,“imagenum”:“AP2”,“rating”:68,“rt”:1026},{“block”:“F2/”,“trialnum”:6,“imagenum”:“AC2”,“rating”:90,“rt”:881},{“block”:“F2/”,“trialnum”:7,“imagenum”:“N1”,“rating”:86,“rt”:970},{“block”:“F2/”,“trialnum”:8,“imagenum”:“AD1”,“rating”:10,“rt”:1554}]”

---

<div class="post-metadata">

**Author:** ![georgewm](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@georgewm](https://discourse.psychopy.org/u/georgewm)\
**Post date:** [August 5, 2020, 6:52pm UTC](https://discourse.psychopy.org/t/saving-data-to-pavlovia-server/12408/2 "2020-08-05T18:52:44Z")

</div>

I have a very similar issue, having developed a Javascript (using p5.js), I need to save the data it generates into the Pavlovia data folder, but cannot discover how to do this. Any guidance or example code would be much appreciated.

---

<div class="post-metadata">

**Author:** ![ribhav99](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/ribhav99/32/14310_2.png) [@ribhav99](https://discourse.psychopy.org/u/ribhav99)\
**Post date:** [February 17, 2021, 4:15pm UTC](https://discourse.psychopy.org/t/saving-data-to-pavlovia-server/12408/3 "2021-02-17T16:15:50Z")

</div>

Did you figure this out? I need help with this too!

---

<div class="post-metadata">

**Author:** ![ribhav99](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/ribhav99/32/14310_2.png) [@ribhav99](https://discourse.psychopy.org/u/ribhav99)\
**Post date:** [February 17, 2021, 4:24pm UTC](https://discourse.psychopy.org/t/saving-data-to-pavlovia-server/12408/4 "2021-02-17T16:24:36Z")

</div>

any luck?

---

<div class="post-metadata">

**Author:** ![attentionperception](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@attentionperception](https://discourse.psychopy.org/u/attentionperception)\
**Post date:** [February 17, 2021, 4:29pm UTC](https://discourse.psychopy.org/t/saving-data-to-pavlovia-server/12408/5 "2021-02-17T16:29:23Z")

</div>

I have not found a solution, so I had to abandon Pavlovia and host my experiment elsewhere, sorry…

---

<div class="post-metadata">

**Author:** ![ribhav99](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/ribhav99/32/14310_2.png) [@ribhav99](https://discourse.psychopy.org/u/ribhav99)\
**Post date:** [February 17, 2021, 4:55pm UTC](https://discourse.psychopy.org/t/saving-data-to-pavlovia-server/12408/6 "2021-02-17T16:55:12Z")

</div>

where did you end up hosting it?

---

<div class="post-metadata">

**Author:** ![attentionperception](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@attentionperception](https://discourse.psychopy.org/u/attentionperception)\
**Post date:** [February 17, 2021, 5:11pm UTC](https://discourse.psychopy.org/t/saving-data-to-pavlovia-server/12408/7 "2021-02-17T17:11:32Z")

</div>

I hosted a database (sql) and database manager (written in python) on an EC2 instance of AWS and used POST and GET requests to the server URL put data there and request block orders respectively.

Code snippet of the POST to give you an idea:  
this.completeExperiment = {  
“uuid”: this.uuid,  
“result”: this.data  
};  
fetch(this.serverUrl + ‘/session/complete’, {  
method: ‘POST’,  
body: JSON.stringify(completeExperiment),  
})  
.then((response) =\> response.json())  
.then((result) =\> {  
console.log(‘Success:’, result);  
// show end text and anything you want to happen on success

```
        })

        .catch((error) => {
            console.error('Error:', error);

```

//put here how to deal with error from the post request

```
        });
```
