[#573] API - edit book error

Migrated from Redmine #573 | Author: Aaron Chen
Status: Rejected | Priority: Normal | Created: 2020-09-15


Dear support, our developer work on edit book API,but seems not work, the error code is -32054, can you help us on this.

Redmine Admin wrote:

please provide raw http request

Aaron Chen wrote:

url:https://user-api.365bookings.cn/admin
params:
{
“id”: “1”,
“jsonrpc”: “2.0”,
“method”: “editBook”,
“params”: {
“shedulerId”:“1115”,
“eventId”:“365”,
“unitId”:“138”,
“clientId”:“4992”,
“startDate”:“2020-09-28”,
“startTime”:“12:00:00”,
“endDate”:“2020-09-28”,
“endTime”:“13:00:00”,
“clientTimeOffset”:“”,
“additional”:“”
}
}
response:
{
“error”: {
“code”: -32054,
“message”: “Selected time start is not available”,
“data”:
},
“id”: “1”,
“jsonrpc”: “2.0”
}

Redmine Admin wrote:

seems error message is more than clear: Selected time start is not available

Aaron Chen wrote:

we used below raw to insert a book, it is successful. So why edit this book got error?

url: https://user-api.365bookings.cn/admin
params:
{
“id”: “1”,
“jsonrpc”: “2.0”,
“method”: “book”,
“params”: {
“eventId”:“365”,
“unitId”:“106,138”,
“clientId”:“4992”,
“startDate”:“2020-09-10”,
“startTime”:“12:00:00”,
“endDate”:“2020-09-10”,
“endTime”:“13:00:00”,
“clientTimeOffset”:“”,
“additional”:“”,
“count”:“”,
“batchId”:“”,
“recurringData”:“”
}
}

response:
{
“result”: {
“require_confirm”: false,
“bookings”: [
{
“id”: “1115”,
“event_id”: “365”,
“unit_id”: “106,138”,
“client_id”: “4992”,
“client_hash”: “9fcac3b2e40399ba56f6dff0152ced66”,
“start_date_time”: “2020-09-10 12:00:00”,
“end_date_time”: “2020-09-10 13:00:00”,
“time_offset”: “0”,
“is_confirmed”: “1”,
“require_payment”: false,
“code”: “00tuy57m”,
“hash”: “86b9039d1c86a143ac15cda07f594fe2”
}
],
“batch_type”: “batch_recurrent_booking”,
“recurrent_batch_id”: “533”,
“batch_hash”: “01f916e8d67b9f29cdefb357dfebcc55”,
“invoice”: null
},
“id”: “1”,
“jsonrpc”: “2.0”
}

Aaron Chen wrote:

url:https://user-api.365bookings.cn/admin
params: {
“id”: “1”,
“jsonrpc”: “2.0”,
“method”: “editBook”,
“params”: {
“shedulerId”:“1115”,
“eventId”:“365”,
“unitId”:“138”,
“clientId”:“4992”,
“startDate”:“2020-09-10”,
“startTime”:“12:00:00”,
“endDate”:“2020-09-10”,
“endTime”:“13:00:00”,
“clientTimeOffset”:“”,
“additional”:“”
}
}
response: {
“error”: {
“code”: -32054,
“message”: “Selected time start is not available”,
“data”:
},
“id”: “1”,
“jsonrpc”: “2.0”
}

Redmine Admin wrote:

you should not pass units such way “unit_id”: “106,138”, it must be only one unit id
now you are going to change unit and service id for booking and selected time is not available for it

Aaron Chen wrote:

Still got error

{
“id”: “1”,
“jsonrpc”: “2.0”,
“method”: “book”,
“params”: {
“eventId”:“365”,
“unitId”:“106”,
“clientId”:“4992”,
“startDate”:“2020-09-10”,
“startTime”:“12:00:00”,
“endDate”:“2020-09-10”,
“endTime”:“13:00:00”,
“clientTimeOffset”:“”,
“additional”:“”,
“count”:“”,
“batchId”:“”,
“recurringData”:“”
}
}

{
“result”: {
“require_confirm”: false,
“bookings”: [
{
“id”: “1116”,
“event_id”: “365”,
“unit_id”: “106”,
“client_id”: “4992”,
“client_hash”: “9fcac3b2e40399ba56f6dff0152ced66”,
“start_date_time”: “2020-09-10 12:00:00”,
“end_date_time”: “2020-09-10 13:00:00”,
“time_offset”: “0”,
“is_confirmed”: “1”,
“require_payment”: false,
“code”: “00tuzdb”,
“hash”: “79ece5872f4a7d211a3585a13d958759”
}
],
“batch_type”: “batch_recurrent_booking”,
“recurrent_batch_id”: “534”,
“batch_hash”: “9f37948c6af0053f99eceb7f0b8015ee”,
“invoice”: null
},
“id”: “1”,
“jsonrpc”: “2.0”
}

Aaron Chen wrote:

{
“id”: “1”,
“jsonrpc”: “2.0”,
“method”: “editBook”,
“params”: {
“shedulerId”:“1116”,
“eventId”:“365”,
“unitId”:“138”,
“clientId”:“4992”,
“startDate”:“2020-09-10”,
“startTime”:“12:00:00”,
“endDate”:“2020-09-10”,
“endTime”:“13:00:00”,
“clientTimeOffset”:“”,
“additional”:“”
}
}

{
“error”: {
“code”: -32054,
“message”: “Selected time start is not available”,
“data”:
},
“id”: “1”,
“jsonrpc”: “2.0”
}

Redmine Admin wrote:

you are changing unit, why it should be available?

Aaron Chen wrote:

of course, we want to change unitid on this example.
is unitid means service provider?

Redmine Admin wrote:

yes, but time is not available for new service provider according to API return

Aaron Chen wrote:

we are doing a test:

  1. book a class for a guest at 2020-09-10 12:00:00 (successful)
  2. and then change some field in this booking, like service provider, service, date, time, etc.(got error)

Redmine Admin wrote:

time must be available for new provider and service when you editing a book

Aaron Chen wrote:

understand, it is word after we changed another unitid.
but when we try the gotevent raw, why we can get the unitid as 138
{
“id”: “1”,
“jsonrpc”: “2.0”,
“method”: “getEventList”,
“params”: {
“searchString”:“”,
“asArray”: “true”
}
}

{
“id”: “525”,
“name”: “Mindful Eating|||正念饮食”,
“duration”: “60”,
“buffertime_before”: “0”,
“buffertime_after”: “0”,
“hide_duration”: “0”,
“description”: “

Mindful eating-this unique workshop is to help you build up your own balanced diet concept and know how to do self-assessment|||<span style="font-size: 1rem;">正念饮食-独特的工作坊将帮助您建立自己的均衡饮食概念,并知道如何进行自我评估

”,
“is_public”: “1”,
“is_active”: “1”,
“position”: “18”,
“file_id”: null,
“seo_url”: null,
“is_recurring”: “0”,
“picture”: null,
“picture_sub_path”: null,
“class_id”: “27”,
“is_visible”: “1”,
“picture_path”: null,
“unit_map”: {
“138”: null
},
“providers”: [
138
],
“price”: “0.0000”,
“plugin_invoice_tax_id”: null,
“currency”: “CNY”,
“tax”: null,
“categories”: [
“4”
],
“position_in_category”: {
“4”: “34”
},
“additional_fields”: [
“1”,
“3”
],
“bookings_limit”: “0”,
“min_group_booking”: “12”
}