Nov 24, 202011:50 PM - edited Nov 25, 202012:17 AM
Contributor
Get Ticket detail by ticket is returning hs_pipeline and hs_pipeline_stage as number
SOLVE
Hi
When I try to get the details of the ticket by this api
Endpoint : /crm/v3/objects/tickets/{ticketId}
It is returning hs_pipeline and hs_pipeline_stage as number(their Id) as shown below in example 1 but I want to get then result as shown in example 2. Is there any way to achive it.
Nov 26, 20202:13 AM - edited Nov 26, 20202:17 AM
Guide | Partner
Get Ticket detail by ticket is returning hs_pipeline and hs_pipeline_stage as number
SOLVE
Hi,
Since you are able to manually crete several deal stages and pipelines in your hubspot account there is nothing uniqe about the either the pipeline or the stage. You may for example name a pipeline stage the same thing in two different pipelines.
You can either request the pipeline information by asking for one pipeline per id with the pipeline get integration.
But I recommend getting the full pipeline list with all its stages and creating an array early on in your code and that specifies all your names for you. I code in PHP and for me it would look similar to this:
/crm/v3/pipelines/{objectType}:
# $a_response_containing_json (where your request response is collected as a json)
foreach ($a_response_containing_json['results'] as $key => $value)
{
$pipeline_id = $a_response_containing_json['results'] [$key]['id'];
$my_pipeline_names[$pipeline_id] = $a_response_containing_json['results'] [$key]['label'];
#to get all your stage names you will have to do an other foreach loop within this array
foreach ($a_response_containing_json['results'][$key]['stages'] as $key2 => $value2){
$stage_id = $a_response_containing_json['results'] [$key]['stages'][$key2]['id'];
$my_stage_names[$stage_id] = $a_response_containing_json['results'] [$key]['stages'][$key2]['label'];
}
}
Nov 26, 20202:13 AM - edited Nov 26, 20202:17 AM
Guide | Partner
Get Ticket detail by ticket is returning hs_pipeline and hs_pipeline_stage as number
SOLVE
Hi,
Since you are able to manually crete several deal stages and pipelines in your hubspot account there is nothing uniqe about the either the pipeline or the stage. You may for example name a pipeline stage the same thing in two different pipelines.
You can either request the pipeline information by asking for one pipeline per id with the pipeline get integration.
But I recommend getting the full pipeline list with all its stages and creating an array early on in your code and that specifies all your names for you. I code in PHP and for me it would look similar to this:
/crm/v3/pipelines/{objectType}:
# $a_response_containing_json (where your request response is collected as a json)
foreach ($a_response_containing_json['results'] as $key => $value)
{
$pipeline_id = $a_response_containing_json['results'] [$key]['id'];
$my_pipeline_names[$pipeline_id] = $a_response_containing_json['results'] [$key]['label'];
#to get all your stage names you will have to do an other foreach loop within this array
foreach ($a_response_containing_json['results'][$key]['stages'] as $key2 => $value2){
$stage_id = $a_response_containing_json['results'] [$key]['stages'][$key2]['id'];
$my_stage_names[$stage_id] = $a_response_containing_json['results'] [$key]['stages'][$key2]['label'];
}
}