# Problem with permisions to get bookings

**URL:** <https://forum.wixstudio.com/t/problem-with-permisions-to-get-bookings/2926>\
**Category:** Ask the community\
**Created:** [March 31, 2022, 10:48am UTC](https://forum.wixstudio.com/t/problem-with-permisions-to-get-bookings/2926 "2022-03-31T10:48:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xpblaha](https://avatars.discourse-cdn.com/v4/letter/x/c68b51/32.png) [@xpblaha](https://forum.wixstudio.com/u/xpblaha)\
**Post date:** [March 31, 2022, 10:48am UTC](https://forum.wixstudio.com/t/problem-with-permisions-to-get-bookings/2926/1 "2022-03-31T10:48:34Z")

</div>

![](https://us1.discourse-cdn.com/wix/original/3X/6/a/6a3cee7968f1a2e00e63f7b3be166cd82322dc1d.png)

---

<div class="post-metadata">

**Author:** ![volkaertskristof](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/volkaertskristof/32/18158_2.png) [@volkaertskristof](https://forum.wixstudio.com/u/volkaertskristof)\
**Post date:** [March 31, 2022, 11:03am UTC](https://forum.wixstudio.com/t/problem-with-permisions-to-get-bookings/2926/2 "2022-03-31T11:03:51Z")

</div>

Hi xpblaha,  
Can you be a bit more precise,  
Like where do you code,  
What kind fo code do u use  
etc.  
With just a screenshot we can’t do anything 🙂

_Kind regards,_  
_Kristof._

---

<div class="post-metadata">

**Author:** ![xpblaha](https://avatars.discourse-cdn.com/v4/letter/x/c68b51/32.png) [@xpblaha](https://forum.wixstudio.com/u/xpblaha)\
**Post date:** [March 31, 2022, 11:55am UTC](https://forum.wixstudio.com/t/problem-with-permisions-to-get-bookings/2926/3 "2022-03-31T11:55:35Z")

</div>

Hello

I tried example of wix-booking-backend. I do not know where set up permisons  
for using this API for wix-booking-backend

this is in file bookModule.jsw

**import** { bookings } **from** “wix-bookings-backend” ;

export function queryBookings ( ) {  
**return** bookings  
. queryBookings ()  
. hasSome ( “status” , [“PENDING\_CHECKOUT” , “CONFIRMED” , “CANCELED” , “PENDING” , “PENDING\_APPROVAL” , “DECLINED”])  
. find ()  
. then (( queryResult ) =\> {  
**return** queryResult . items ;  
})  
. **catch** (( error ) =\> {  
**return** error ;  
});  
}

and this is in file booking.js

**import** wixData **from** ‘wix-data’ ;  
**import** { bookings } **from** “wix-bookings-backend” ;

**const** g\_options = {  
suppressAuth : **true**  
}

**export async function** buildTable ( data ) {

```
**try** { 
    **const** allBookings = **await** retrieveAllBookings ( data ); 
    
    **return** allBookings ; 
} **catch** ( error ) { 
    **throw new** Error ( 'fail to buildTable original error - ' + error . message ); 
} 

```

}

// Get all bookings from start date to end date  
**async function** retrieveAllBookings ( data ) {  
**let** allItems = ;

```
**try** { 
    // Query to get the bookings by date 
    **let** results = **await** bookings . queryBookings (); 

    allItems = allItems . concat ( results . items ); 
    // Check if there are more items that match the query and get them 
    **while** ( results . hasNext ()) { 
        results = **await** results . next (); 
        allItems = allItems . concat ( results . items ); 
    } 
    // Filter the booking items by attended bookings only 
    **const** attendedBookings = allItems . filter ( book => { 
        **if** ( book . attendanceInfo ) { 
            **return** book . attendanceInfo . attendanceStatus == **true** 
        } 
    }); 

    **return** attendedBookings ; 
} **catch** ( error ) { 
    **throw new** Error ( 'fail to retrieveAllBookings original error - ' + error . message ); 
} 

```

}

// Build the JSON of all staff members with session data

}
