Search code examples
jsonpipedrive-api

Pipedrive api get all deals - deal title must be given


I'm trying to return all deals via the Pipedrive api. Using this code I'm getting an error - Deal title must be given. Is there not a way to return all deals? According to the docs there is. Anyone have experience with this?

$.ajax({
    type: 'POST',
    url: 'https://api.pipedrive.com/v1/deals',
    data: { api_token: myToken },
    success: function (data) {
        var result = data.data[0];
    },
    error: function (xhr) {
        var error = xhr.responseJSON.error;
    }
});

For the record it works when I pass in a deal title, but I need to get the entire result set.


Solution

  • You are making a POST request and that is for adding Deals and for that a title is required. You should be making a GET request instead.