duffelhq / duffel-api-javascript

JavaScript client library for the Duffel API

Home Page:https://duffel.com/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wierd issue with Stays API

randomprogramming opened this issue · comments

I've been trying out duffel API for some time now, everything seems to be working okay, but today I tried using the Stays API as so:

try {
    return await this.duffel.stays.search({
        rooms: 1,
        adults: 2,
        location: {
            radius: 5,
            geographic_coordinates: {
                longitude: 2.4468358606916354,
                latitude: 48.86873001352504,
            },
        },
        check_out_date: "2024-05-01",
        check_in_date: "2024-05-10",
    });
} catch (e) {
    console.log("Error:");
    console.log(JSON.stringify(e));
}

And this simply prints out:

Error:
{"headers":{}}

I tried debugging and looking at the error closely, but there's no helpful information. Not sure what's going on?

I think something might be wrong with the stays api on test? I tried it like this and I get a 404:

const resp = await axios.post(
"https://api.duffel.com/stays/search",
{
    rooms: 1,
    adults: 2,
    location: {
        radius: 99,
        geographic_coordinates: {
            longitude: 2.4468358606916354,
            latitude: 48.86873001352504,
        },
    },
    check_out_date: "2024-05-01",
    check_in_date: "2024-05-10",
},
{
    headers: {
        "Duffel-Version": "v1",
        "Accept-Encoding": "gzip",
        Accept: "application/json",
        "Content-Type": "application/json",
        Authorization: "Bearer " + "my_token",
    },
}
);

Hmh. After further reading it seems like Stays is only available for "enterprise" clients? Would love to be able to still access the test data for testing out an MVP without actually having to open a business..

commented

Hi @randomprogramming, to be able to use the Stays API, even in development, you need to contact us so we can enable it for you. Sorry about the trouble but that's important for us to maintain good relationships with our content suppliers and do our best to understand your use case.