Matozinho
(Felipi Lima Matozinho)
October 6, 2021, 2:18pm
1
I’m trying to get product information from a deal in CRM from a front-end app using the request method, as show in the code.
const { response } = await client.request.get(
`${https://mydomain.freshworks.com/crm/sales/api/deals}/${dealId}?include=deal_product`,
{
headers: {
'Content-Type': 'application/json',
'Authorization': `Token token=${token}`,
},
},
);
The response show the has_product variable as true, but the deal_product_id comes null. Beside that, the deal_products array (from include=deal_product) comes empty.
Is this a bug in my code or an API error?
Santhosh
(Santhosh Balusamy)
October 7, 2021, 7:26am
3
Hi @Matozinho ,
Good Day!
seems like the code you wrote is not in the correct format
I think there is a problem with your destructuring the requestAPI response,
can you please try with the below snippet and do let me know if it does not work?
const response = await client.request.get(
`${https://mydomain.freshworks.com/crm/sales/api/deals}/${dealId}?include=deal_product`,
{
headers: {
'Content-Type': 'application/json',
'Authorization': `Token token=${token}`,
},
},
);
Hope it helps
Thanks
1 Like
Matozinho
(Felipi Lima Matozinho)
October 7, 2021, 2:20pm
4
Hi @Santhosh , Good Day !
Thanks for the answer, but the destructuring is correct, because all other information that I use are correct (like the amount), except the deal_product_id.
Using your snippet I recieved the same result:
The response variable:
The response.response (deal object):
The response.response (deal_products object):
The has_products is true, the deal_product_id is null and the deal_products array is empty .
Santhosh
(Santhosh Balusamy)
October 7, 2021, 4:01pm
5
@Matozinho ,
Thanks for the clarification,
Let me check with the product team and get back to you at the earliest
Thanks
1 Like
Santhosh
(Santhosh Balusamy)
October 8, 2021, 7:32am
7
@Matozinho ,
It seems there is an issue with the account, I request you to create an L2 ticket by sending an email to support@freshsales.io
Thanks
1 Like
Matozinho
(Felipi Lima Matozinho)
October 8, 2021, 1:28pm
8
Thanks @Santhosh , I already sent the email .
Hi @Matozinho
Can you try using the below url,
“https://domain.myfreshworks.com/crm/sales/deals/id?include=products ”
We are working on the Products module API but for now do let me know if this works for you.
Thanks
3 Likes
Matozinho
(Felipi Lima Matozinho)
October 11, 2021, 12:27pm
10
Hi @Pulkit_Chowdry , it worked!
the products come in a array inside the deal object.
Thanks !
1 Like
system
(system)
Closed
October 17, 2021, 6:27pm
11
This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.