[SOLVED] Adding Cards to Dashboard, Endpoint Does Not Exist?

Hi, I’m trying to add a card to a newly made dashboard. I noticed from seeing how Metabase works (through the Network tab in the Developer Console) that for each card added, Metabase uses both a POST and PUT request to the /api/dashboard/:id/cards endpoint.

However, when I first try to send the POST request it always gives me a 404 error, saying the API endpoint does not exist.

The way I’m doing this is first, I make the card (based on a card from another Dashboard) and then I want to add that to the new Dashboard:

axiosOptions = {
    method: 'POST',
    url: dashboard_api_url + dashboardId + '/cards/',
    headers: axiosConfig,
    data: {
        cardId: response.data.id
    }
};

axios(axiosOptions)
.then(response => {
    axiosOptions = {
        method: 'PUT',
        url: dashboard_api_url + dashboardId + '/cards/',
        headers: axiosConfig,
        data: {
            // PUT data
        }
    }
    console.log(response);
})
.catch(err => { console.log(err); });

But I can’t even get past the POST which always returns a 404. Did I misunderstand how to add cards to the Dashboard?

Thanks in advance!

Hi @gliwidilt
The API URLs doesn’t end with a slash.

1 Like

Oh goodness, didn’t think the problem was THAT simple. I sort of assumed that since http://localhost:3000/api/dashboard/ worked fine with the final slash that this would work too. Thanks a lot!