duffelhq / duffel-api-javascript

JavaScript client library for the Duffel API
https://duffel.com/docs
MIT License
36 stars 12 forks source link

Wierd issue with Stays API #905

Closed randomprogramming closed 7 months ago

randomprogramming commented 7 months ago

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?

randomprogramming commented 7 months ago

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",
    },
}
);
randomprogramming commented 7 months ago

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..

igorp1 commented 7 months ago

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.