[#1191] Issue when calling the Edit Booking endpoint

Migrated from Redmine #1191 | Author: Guilherme Bueno
Status: Closed | Priority: Immediate, there is BUG! | Created: 2024-03-08


Calling a PUT on https://user-api-v2.simplybook.plus/admin/bookings/booking_id returns a 404, meaning booking hasn’t been found but calling a GET on it shows that the booking exists.
Calling a GET on https://user-api-v2.simplybook.plus/admin/booking/booking_id (without the “s”) also returns a 404, but clearly the booking exists as you can see in the last response.

Body of the request for the PUT method:


{
  "count":"1",
  "start_datetime":"2024-03-15 15:15:00",
  "provider_id":2,
  "service_id":26,
  "location_id":6,
  "client_id":16819,
  "accept_payment":"true",
  "payment_processor":"Stripe",
  "additional_fields":[
    {
      "field":"473dd5d43a9146537758de98a4909a18",
      "value":"Confirmed"
    },
    {
      "field":"d5f910103c49904d8ac7b7a59be249b5",
      "value":"Customer agreed to pay $99"
    }
  ]
}

Request headers:


"headers" => [
      "X-Token" => "token"
      "X-Company-Login" => "santemedic1"
      "Content-type" => "application/json; charset=utf-8"
      "User-Agent" => "GuzzleHttp/6.5.5 curl/7.64.0 PHP/7.2.34"
    ]

Response when calling GET to see that booking with that id exists:


{
  "log": [...],
  "additional_fields": [...],
  "products": [],
  "attributes": [],
  "invoice": {...},
  "membership": null,
  "user_status": null,
  "comment": null,
  "resources": [],
  "record_date": "2024-03-08 15:58:43",
  "batch_type": null,
  "batch_id": null,
  "provider": {...},
  "service": {...},
  "client": {...},
  "status": "confirmed",
  "membership_id": null,
  "invoice_id": 17666,
  "invoice_status": "paid",
  "invoice_payment_received": true,
  "invoice_number": "I-00010583",
  "invoice_datetime": "2024-03-08 10:58:43",
  "invoice_payment_processor": "stripe",
  "ticket_code": null,
  "ticket_validation_datetime": null,
  "ticket_is_used": null,
  "testing_status": null,
  "user_status_id": null,
  "category_id": null,
  "location_id": 2,
  "category": null,
  "location": {...},
  "can_be_edited": true,
  "can_be_canceled": true,
  "id": 18653,
  "code": "06wee458e",
  "start_datetime": "2024-03-15 15:15:00",
  "end_datetime": "2024-03-15 15:30:00",
  "service_id": 26,
  "provider_id": 2,
  "client_id": 16819,
  "duration": 15
}

Any help is appreciated, please let me know if you need any more information.

Dmytro Bondarev wrote:

Hi, please provide http request with URL, headers and body

Guilherme Bueno wrote:

PUT request:
URL: https://user-api-v2.simplybook.plus/admin/bookings/18653
Body:


{
  "count": "1",
  "start_datetime": "2024-03-15 15:15:00",
  "provider_id": 2,
  "service_id": 26,
  "location_id": 6,
  "client_id": 16819,
  "accept_payment": "true",
  "payment_processor": "Stripe",
  "additional_fields": [
    {
      "field": "473dd5d43a9146537758de98a4909a18",
      "value": "Confirmed"
    },
    {
      "field": "d5f910103c49904d8ac7b7a59be249b5",
      "value": "Customer agreed to pay $99"
    }
  ]
}

Header:


"headers" => [
    "X-Token" => "22c9bb7ac78101fe0f4030f32f749ba4f6e456b18e3593a6db71974cc59c85c9"
    "X-Company-Login" => "santemedic1"
    "Content-type" => "application/json; charset=utf-8"
  ]

GET request for multiple bookings
URL: https://user-api-v2.simplybook.plus/admin/bookings/18653
No body for this one
Header:


"headers" => [
    "X-Token" => "22c9bb7ac78101fe0f4030f32f749ba4f6e456b18e3593a6db71974cc59c85c9"
    "X-Company-Login" => "santemedic1"
    "Content-type" => "application/json; charset=utf-8"
  ]

GET request for single booking
URL: https://user-api-v2.simplybook.plus/admin/booking/18653
No body for this one
Header:


"headers" => [
    "X-Token" => "22c9bb7ac78101fe0f4030f32f749ba4f6e456b18e3593a6db71974cc59c85c9"
    "X-Company-Login" => "santemedic1"
    "Content-type" => "application/json; charset=utf-8"
  ]

The put request returns a 404, the get request for multiple bookings returns what I outlined above and the get request for a single booking returns also a 404

Guilherme Bueno wrote:

Guilherme Bueno wrote:

PUT request:
URL: https://user-api-v2.simplybook.plus/admin/bookings/18653
Body:
[…]
Header:
[…]

GET request for multiple bookings
URL: https://user-api-v2.simplybook.plus/admin/bookings/18653
No body for this one
Header:
[…]

GET request for single booking
URL: https://user-api-v2.simplybook.plus/admin/booking/18653
No body for this one
Header:
[…]

The put request returns a 404, the get request for multiple bookings returns what I outlined above and the get request for a single booking returns also a 404

Dmytro Bondarev wrote:

Hi, please provide http request with URL, headers and body

Do you need anything else?

Dmytro Bondarev wrote:

Thank you, we will investigate and let you know.

Guilherme Bueno wrote:

Dmytro Bondarev wrote:

Thank you, we will investigate and let you know.

Any news?

Dmytro Bondarev wrote:

Hi, please just make sure that you pass all ids, that exist in your company.
In your example location_id is not valid.

Guilherme Bueno wrote:

Dmytro Bondarev wrote:

Hi, please just make sure that you pass all ids, that exist in your company.
In your example location_id is not valid.

Thanks for the help! It worked

Dmytro Bondarev wrote:

You are welcome. Have a good weekend.