[#915] Create booking api always return 400 with no details

Migrated from Redmine #915 | Author: brian kling
Status: New | Priority: Immediate, there is BUG! | Created: 2022-07-28


trying to hit

POST https://user-api-v2.simplybook.me/admin/bookings

to create a new booking, and we get this very vague error response, even if the api key is invalid or valid:

400 Bad Request

400 Bad Request


nginx

Example payload:

{
“start_datetime”: “2022-07-30 00:00:00”,
“end_datetime”: “2022-07-30 00:15:00”,
“provider_id”: 1,
“service_id”: 110,
“client_id”: 11,
“location_id”: 1,
“category_id”: 1,
“count”: 1
}

can you please paste a working example, this code does not work:

    var config = {
        method: 'post',
        url: `https://user-api-v2.simplybook.me/admin/bookings`,
        headers: { 
        'Content-Type': 'application/json',
        'X-Company-Login': 'xxxxxx', 
        'X-Token': simplyBookApiKey
        },
        data: bookingObj
        
    };

    let resp = await axios(config);
    console.log("GET RESPONSE: ", resp.data);

Dmytro Bondarev wrote:

Hi, can you please provide RAW HTTP request?

brian kling wrote:

Dmitry Bondarev wrote:

Hi, can you please provide RAW HTTP request?

POST /admin/bookings HTTP/1.1
Host: user-api-v2.simplybook.me
X-Company-Login: xxxxx
X-Token: 20642e45cfaa738e4954f8c…
Content-Type: application/json
Content-Length: 200

{
“start_datetime”: “2022-07-30 00:00:00”,
“end_datetime”: “2022-07-30 00:15:00”,
“provider_id”: 1,
“service_id”: 110,
“client_id”: 11,
“location_id”: 1,
“category_id”: 1,
“count”: 1
}

company name and token have been obscured for security, but we are able to hit all the other rest endpoints just fine like cancel meeting which is used frequently.

brian kling wrote:

Dmitry Bondarev wrote:

Hi, can you please provide RAW HTTP request?

also, here is example of working code to another endpoint with the same exact request settings:

let bookingId = req.body.bookingId;

        var config = {
            method: 'get',
            url: `https://user-api-v2.simplybook.me/admin/bookings/${bookingId}`,
            headers: { 
            'Content-Type': 'application/json',
            'X-Company-Login': 'xxxxxx', 
            'X-Token': simplyBookApiKey
            }
            
        };

        let resp = await axios(config);
        console.log("GET RESPONSE: ", resp.data);