Dai
May 2, 2020, 3:12pm
1
Hey guys,
I just can’t get it to work. I’m using the node client and also tried it in the docs with chrome. Heres the request:
https://api.pipedrive.com/v1/deals/timeline?start_date=2020-02-01&interval=week&amount=2&field_key=title&api_token=TOKEN
but it returns:
{
“success”: false,
“error”: “Invalid field_key.”,
“error_info”: “Please check developers.pipedrive.com for more information about Pipedrive API.”,
“data”: null,
“additional_data”: null
}
I got the deal fields by calling getAllDealFields() and “title” was present. But somehow I always get the invalid field_key response, no matter which key I try.
David
May 4, 2020, 9:02am
2
Hi @Dai , welcome to the commmunity!
To get this to work, you need to add the Field’s “Key” and not its “name” (I can see how the can be confusing on the reference page).
For instance, if you’re going off the Field ‘Next Activity Date’, you would use the Key “next_activity_date”
Dai
May 4, 2020, 11:35am
3
Hey @David , thanky ou!
I added the “key” and not it’s “name”. Here is the example of the dealField:
id: 12453
key: “user_id”
name: “Owner”
I use “user_id” for my requests but it’s returning “error”:“Invalid field_key.”. Here is how I build the input.
Code
input["startDate"] = dateString;
input["interval"] = interval;
input["fieldKey"] = "user_id"
input["amount"] = diffDays
const result = await lib.DealsController.getDealsTimeline(input, function(error, response, context) {
if(response){
console.log(response.data)
return response.data
});
David
May 4, 2020, 11:38am
4
If you’re using the GET /deals/timeline endpoint, then the field_key here needs to be a date type field.
If you’re not sure which Fields are Date type, you can use GET /dealFields to see all the Deal fields and the type each one is.
1 Like
Dai
May 4, 2020, 11:54am
5
I’m blind, it says date type field twice and I overlooked it. It worked after I chose a date type field key. Thank you very much!
1 Like
Dai
May 6, 2020, 10:48am
6
@David sorry to trouble you again. I’m getting the data in the network section of the dev console, but I cannot print it in the console:
Data29 {period_start: null, period_end: null, totals: null}
And the network tab call:
{“success”:true,“data”:[{“period_start”:“2020-05-06 00:00:00”,“period_end”:“2020-05-06
23:59:59”,“deals”:[{“id”:…}
I saw a simliar issue in the github for the node client. The request is also returning null only https://github.com/pipedrive/client-nodejs/issues/149
//update
Made the call with axios.get and it worked with the same parameters. Seems like an issue with the client.
1 Like
David
May 7, 2020, 8:27am
7
Thanks for informing us on this. I’ll have our team look at the client.