# What event happen and what API can use?

**URL:** https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540
**Category:** Development
**Created:** [January 13, 2016, 11:32am UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540 "2016-01-13T11:32:22Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 11:32am UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/1 "2016-01-13T11:32:22Z")

</div>

hi: when the folder set master , other device change the file that have synchronize , the master device which evevt will happen ? which API that i can “Override Changes” ?

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [January 13, 2016, 11:37am UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/2 "2016-01-13T11:37:54Z")

</div>

Good question. It’s the `/rest/db/override` endpoint, which seems to be missing from the documentation. POST to it with `?folder=folderID` as a query parameter. On the event side, look for FolderSummary.

---

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 11:45am UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/3 "2016-01-13T11:45:43Z")

</div>

1,"/rest/db/override" endpoint , this isn’t public API ? i didn’t found it in “Database Endpoints” ! 2,when the master folder “FolderSummary” enent happen ,that mean other device have change the synchronize files ? i can post the “/rest/db/override” to change the files to old status ?

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [January 13, 2016, 11:56am UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/4 "2016-01-13T11:56:54Z")

</div>

It’s as public as anything, we’ve just forgotten to document it, apparently. The FolderSummary is emitted when the amount of data in, or needed by, a folder has changed. In this case, since it’s a master folder it should not need data from anyone else. So in that event, `needBytes` \> 0 should indicate that you’re out of sync and can use the override if you like.

---

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 12:07pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/5 "2016-01-13T12:07:11Z")

</div>

thanks Borg: i will write code according to you tell !! recently i wirte code that use API to control the syncthing , but now , i found ,perhaps the syncthing should add some folder model ! why i say this ? just now ,i test the syncthing with three device , one folder is master ,other is ordinary , i hope , the master’s file couldn’t change by other device ,but when other device change synchronized files , the ordinary device also changed , this isn’t i hope ,at last i use the master device override the change ,that mean all change will pass by the master device , that’s so inefficiency , all data will get through the master device again , isn’t it ?

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [January 13, 2016, 12:52pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/6 "2016-01-13T12:52:17Z")

</div>

Potentially, but you if you behave well and don’t modify the data where you are not supposed to, you won’t get into this state

---

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 12:57pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/7 "2016-01-13T12:57:54Z")

</div>

if someone use one device attack the syncthing ? the syncthing will in what status ? will always transmitall data ?

---

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 1:03pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/8 "2016-01-13T13:03:21Z")

</div>

now , i think the syncthing’s folder model isn’t rigorous folder model !

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [January 13, 2016, 1:08pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/9 "2016-01-13T13:08:37Z")

</div>

I’m not sure what you mean, exactly?

---

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 1:08pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/10 "2016-01-13T13:08:45Z")

</div>

when i change the ordinary device 's file name , the master device notifiy the FolderSummary event , but couldn’t override the file that by change file name !

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [January 13, 2016, 1:09pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/11 "2016-01-13T13:09:29Z")

</div>

I’m still not really sure what you mean, sorry.

---

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 1:19pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/12 "2016-01-13T13:19:13Z")

</div>

Borg: which IM you use ,can you give me your IM , i want to direct talk to you , this is my email , if you can give me your IM ,please send to my Email :sunylat@163.com ， thank you !

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [January 13, 2016, 1:38pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/13 "2016-01-13T13:38:46Z")

</div>

No thanks, this is about as realtime as it gets for me. Other stuff ongoing as well, such as work. 😉

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [January 13, 2016, 2:11pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/14 "2016-01-13T14:11:46Z")

</div>

It’s by design, and yes, everyone would get data from the master as the override happens. There is a pull request in progress which makes more efficient by sharing partial data between the devices.

Override should rename the file back.

---

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 2:16pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/15 "2016-01-13T14:16:11Z")

</div>

OK , then we talk at here ! the syncthing is good work , i decide use it in the future ! before i have use the BTSync ，i think the BTSync’s model good then the syncthing ,below is the reason: 1,Simple:any node only need the key ,didn’t need other , the node can accept the p2p system ! 2,more safety:this better then the syncthing , in the BTSync , if the mode is readonly , the node only can accept other node change ,but this node’s change didn’t affect other node ,this is very important ! because i think the readonly p2p node should only work for itself, couldn’t affect by other node !

the p2p system perhaps attack by someone , the BTSync’s readonly can avoid attack !! if the node is readonly , whether how change the files that in this node ,it wouldn’t affect other node !! i think this is better model !!

---

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 2:18pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/16 "2016-01-13T14:18:07Z")

</div>

Which property decide the device is the master ?

---

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 2:28pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/17 "2016-01-13T14:28:17Z")

</div>

i found an question , when other node change the synchronize file’s name , the master device get the change ,but couldn’t override the file !

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [January 13, 2016, 2:29pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/18 "2016-01-13T14:29:09Z")

</div>

There is a readOnly property on folder section in the config to indicate that this device will refuse any updates from anyone.

I understand how BTSync works, but this is not how syncthing works, and if that doesn’t suit your needs, feel free to go back to BTSync.

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [January 13, 2016, 2:29pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/19 "2016-01-13T14:29:59Z")

</div>

It should, I will test it at home.

---

<div class="post-metadata">

### Author: ![sunylat](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@sunylat](https://forum.syncthing.net/u/sunylat)
#### Post date: [January 13, 2016, 2:30pm UTC](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540/20 "2016-01-13T14:30:29Z")

</div>

thank you AudriusButkevicius !

[Next page](https://forum.syncthing.net/t/what-event-happen-and-what-api-can-use/6540.md?page=2)
