[#1254] Unable to filter the data based on date_from in getBookingReport ()

Migrated from Redmine #1254 | Author: Shubham Kamble
Status: Feedback | Priority: Low, I can wait | Created: 2024-07-10


I trying to get the data from the getBookingReport () using python script. I am getting the data successfully but i want the data from the specific date and that is not being working at my end. Below is the documentation link.

COMPANY_LOGIN =
API_KEY =
USER_LOGIN =
USER_PASSWORD =
SECRET_KEY =

class JSONRpcClient:
def init(self, url, headers):
self.url = url
self.headers = headers

def call(self, method, params=None):
payload = {
‘jsonrpc’: ‘2.0’,
‘method’: method,
‘params’: params or ,
‘id’: 0
}
response = requests.post(self.url, headers=self.headers, json=payload)
return response.json()
api = SimplyBookAPI(COMPANY_LOGIN, API_KEY, USER_LOGIN, USER_PASSWORD, SECRET_KEY)

admin_client = JSONRpcClient(
https://user-api.simplybook.pro/admin/’,
headers={
‘X-Company-Login’: COMPANY_LOGIN,
‘X-User-Token’: api.user_token
}

)

filters = [{
“created_date_from”: “2024-05-09”,
} ]
booking_report = admin_client.call(‘getBookingReport’, [filters])
print(“Booking Reports:”, json.dumps(booking_report, indent=4))

Dmytro Bondarev wrote:

Hi,
We need HTTP request that you make to our server.

Shubham Kamble wrote:

Dmytro Bondarev wrote:

Hi,
We need HTTP request that you make to our server.

POST /admin/ HTTP/1.1
Host: user-api.simplybook.pro
X-Company-Login: [COMPANY_LOGIN]
X-User-Token: [USER_TOKEN]
Content-Type: application/json

{
“jsonrpc”: “2.0”,
“method”: “getBookingReport”,
“params”: [
{
“created_date_from”: “2024-05-09”
}
],
“id”: 0
}

Dmytro Bondarev wrote:

Hi, as i mentioned in another ticket you should pass it under filter object:
Please try:

POST /admin/ HTTP/1.1
Host: user-api.simplybook.pro
X-Company-Login: [COMPANY_LOGIN]
X-User-Token: [USER_TOKEN]
Content-Type: application/json

{
"jsonrpc": "2.0",
"method": "getBookingReport",
"params": [ {
    "filter": {
        "created_date_from": "2024-05-09"
    }
}], "id": 0}

Shubham Kamble wrote:

How to get entire page data

Dmytro Bondarev wrote:

What is entire page data?

Shubham Kamble wrote:

after applying the filter i am getting the single page data only. i want to get the data from next pages as well.

payload = {
‘jsonrpc’: ‘2.0’,
‘method’: method,
‘params’: [ {
“filter”: {
‘date_from’: one_day_back_str,
‘date_to’: four_months_later,
‘Order’:‘date_start_asc’,
# ‘booking_type’:‘all’
}
}],

        'id': 1
    }

Dmytro Bondarev wrote:

You can use page parameter:

'params': [{
   "page": 2,
   "filter": {.....

Shubham Kamble wrote:

Thank You…

(Short original content)