# Not being able to do simple script (I'm a newbie)

**URL:** <https://community.fibery.io/t/not-being-able-to-do-simple-script-im-a-newbie/4930>\
**Category:** API & Programming\
**Created:** [August 8, 2023, 8:21pm UTC](https://community.fibery.io/t/not-being-able-to-do-simple-script-im-a-newbie/4930 "2023-08-08T20:21:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mateus\_Zuliani](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mateus_zuliani/32/7338_2.png) [@Mateus\_Zuliani](https://community.fibery.io/u/Mateus_Zuliani)\
**Post date:** [August 8, 2023, 8:21pm UTC](https://community.fibery.io/t/not-being-able-to-do-simple-script-im-a-newbie/4930/1 "2023-08-08T20:21:59Z")

</div>

I’m trying to run this to delete all entities in a database inside a space:

```auto
const fibery = context.getService('fibery');

for (const entity of args.currentEntities) { 
    await fibery.deleteEntity(entity.id, entity.id) 
}

```

I’m getting this error though (in console):

```auto
WebSocket connection to 'wss://matzu.fibery.io/api/online-users' failed: 
webSocket is closed before the connection is established.

```

Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [August 8, 2023, 8:25pm UTC](https://community.fibery.io/t/not-being-able-to-do-simple-script-im-a-newbie/4930/2 "2023-08-08T20:25:27Z")

</div>

Will [this](https://the.fibery.io/@public/User_Guide/Guide/Spaces-18/anchor=Delete-Space-Data--61380fae-1b25-4724-9dea-4c2575c9c603) work for you? It will delete all data in **ALL DBs** in a Space:

> ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/5/5c19d96287de637c076b058e410c8b4efd57ce24.png)

Otherwise you can use a Table View of your DB to select all entities with a single click, then [delete them all via the Actions menu](https://the.fibery.io/@public/User_Guide/Guide/Table-View-11/anchor=Batch-actions--e794365f-28e5-49fa-8e0b-0da6a66b2104):

> ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/f/faf746c4358ee415d496da32bee58818603d4496.png)

---

<div class="post-metadata">

**Author:** ![Mateus\_Zuliani](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mateus_zuliani/32/7338_2.png) [@Mateus\_Zuliani](https://community.fibery.io/u/Mateus_Zuliani)\
**Post date:** [August 8, 2023, 8:30pm UTC](https://community.fibery.io/t/not-being-able-to-do-simple-script-im-a-newbie/4930/3 "2023-08-08T20:30:24Z")

</div>

I don`t think so…

I want to do it with a script because I want to “sync” my calendar with fibery. In work we have kind like an outlook provider and the only thing I can get is the ics…

I want to delete all the entries from this “Calendar” space and then run through the ics to recreate (update) my calendar events…

The ics part is done, but I started creating the fibery part and can’t get to make it work…

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [August 8, 2023, 9:27pm UTC](https://community.fibery.io/t/not-being-able-to-do-simple-script-im-a-newbie/4930/4 "2023-08-08T21:27:18Z")

</div>

Check your args to fibery.deleteEntity:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/4/4b1e61f29f4019de90cd560d9bbd0ac2d6671dcb.png)
