Get Pipelines in a Layout

Purpose

To fetch the details of all or a specific pipeline in the Deals module.

Request Details

Request URL

All - {api-domain}/crm/{version}/settings/pipeline?layout_id={layout_id}
Specific - {api-domain}/crm/{version}/settings/pipeline/{pipeline_ID}?layout_id={layout_id}

Header

Authorization: Zoho-oauthtoken <access_token>

Scope

scope=ZohoCRM.settings.pipeline.READ

Parameters
  • layout_idstring, mandatory

    The unique ID of the layout in the Deals module you want to fetch the pipeline's details from. Note that this parameter is mandatory for fetching all pipelines and a specific pipeline. The system throws an error, otherwise.

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v2.1/settings/pipeline?layout_id=3652397000000091023"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
4.0.04.x
Copied//Get instance of PipelineOperations Class
$pipelineOperations = new PipelineOperations($layoutId);
//Call getPipelines method
$response = $pipelineOperations->getPipelines();

//Get instance of PipelineOperations Class
$pipelineOperations = new PipelineOperations($layoutId);
//Call getPipeline method
$response = $pipelineOperations->getPipeline($pipelineId);
Copied<?php
class GetPipeline{
    
    public function execute(){
        $curl_pointer = curl_init();
        
        $curl_options = array();
        $url = "https://www.zohoapis.com/crm/v2.1/settings/pipeline?";
        $parameters = array();
        $parameters["layout_id"]="34770610087501";

        foreach ($parameters as $key=>$value){
            $url =$url.$key."=".$value."&";
        }
        $curl_options[CURLOPT_URL] = $url;
        $curl_options[CURLOPT_RETURNTRANSFER] = true;
        $curl_options[CURLOPT_HEADER] = 1;
        $curl_options[CURLOPT_CUSTOMREQUEST] = "GET";
        $headersArray = array();
        $headersArray[] = "Authorization". ":" . "Zoho-oauthtoken " ."1000.30f3a589XXXXXXXXXXXXXXXXXXX4077.dc5XXXXXXXXXXXXXXXXXXXee9e7c171c";
        $curl_options[CURLOPT_HTTPHEADER]=$headersArray;
        
        curl_setopt_array($curl_pointer, $curl_options);
        
        $result = curl_exec($curl_pointer);
        $responseInfo = curl_getinfo($curl_pointer);
        curl_close($curl_pointer);
        list ($headers, $content) = explode("\r\n\r\n", $result, 2);
        if(strpos($headers," 100 Continue")!==false){
            list( $headers, $content) = explode( "\r\n\r\n", $content , 2);
        }
        $headerArray = (explode("\r\n", $headers, 50));
        $headerMap = array();
        foreach ($headerArray as $key) {
            if (strpos($key, ":") != false) {
                $firstHalf = substr($key, 0, strpos($key, ":"));
                $secondHalf = substr($key, strpos($key, ":") + 1);
                $headerMap[$firstHalf] = trim($secondHalf);
            }
        }
        $jsonResponse = json_decode($content, true);
        if ($jsonResponse == null && $responseInfo['http_code'] != 204) {
            list ($headers, $content) = explode("\r\n\r\n", $content, 2);
            $jsonResponse = json_decode($content, true);
        }
        var_dump($headerMap);
        var_dump($jsonResponse);
        var_dump($responseInfo['http_code']);
        
    }
    
}
(new GetPipeline())->execute();

Possible Errors

  • INVALID_DATAHTTP 400

    The layout ID is invalid.
    Resolution: Specify the correct layout ID. Use the Layouts Metadata API to get the ID of the layout.

  • REQUIRED_PARAM_MISSINGHTTP 400

    You have not included the mandatory parameter "layout_id" in your request.
    Resolution: "layout_id" is a mandatory parameter while fetching all or a specific pipeline from the Deals module.

  • NO_CONTENTHTTP 204

    You have either passed an incorrect value for the pipeline ID in the request, or you have not created a pipeline in that layout.
    Resolution: Specify the correct pipeline ID in the request.

Sample Response

Copied{
    "pipeline": [
        {
            "display_value": "Standard (Standard)",
            "default": true,
            "maps": [
                {
                    "display_value": "Qualification",
                    "sequence_number": 1,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Qualification",
                    "id": "3652397000000006801",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Needs Analysis",
                    "sequence_number": 2,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Needs Analysis",
                    "id": "3652397000000006803",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Value Proposition",
                    "sequence_number": 3,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Value Proposition",
                    "id": "3652397000000006805",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Identify Decision Makers",
                    "sequence_number": 4,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Id. Decision Makers",
                    "id": "3652397000000006807",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Proposal/Price Quote",
                    "sequence_number": 5,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Proposal/Price Quote",
                    "id": "3652397000000006811",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Negotiation/Review",
                    "sequence_number": 6,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Negotiation/Review",
                    "id": "3652397000000006813",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Closed Won",
                    "sequence_number": 7,
                    "forecast_category": {
                        "name": "Closed",
                        "id": "3652397000000006789"
                    },
                    "actual_value": "Closed Won",
                    "id": "3652397000000006815",
                    "forecast_type": "Closed Won"
                },
                {
                    "display_value": "Closed Lost",
                    "sequence_number": 8,
                    "forecast_category": {
                        "name": "Omitted",
                        "id": "3652397000000006791"
                    },
                    "actual_value": "Closed Lost",
                    "id": "3652397000000006817",
                    "forecast_type": "Closed Lost"
                },
                {
                    "display_value": "Closed-Lost to Competition",
                    "sequence_number": 9,
                    "forecast_category": {
                        "name": "Omitted",
                        "id": "3652397000000006791"
                    },
                    "actual_value": "Closed Lost to Competition",
                    "id": "3652397000000006819",
                    "forecast_type": "Closed Lost"
                }
            ],
            "actual_value": "Standard (Standard)",
            "id": "3652397000003097001"
        },
        {
            "display_value": "Pipeline1",
            "default": false,
            "maps": [
                {
                    "display_value": "Qualification",
                    "sequence_number": 1,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Qualification",
                    "id": "3652397000000006801",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Needs Analysis",
                    "sequence_number": 2,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Needs Analysis",
                    "id": "3652397000000006803",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Value Proposition",
                    "sequence_number": 3,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Value Proposition",
                    "id": "3652397000000006805",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Proposal/Price Quote",
                    "sequence_number": 4,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Proposal/Price Quote",
                    "id": "3652397000000006811",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Negotiation/Review",
                    "sequence_number": 5,
                    "forecast_category": {
                        "name": "Pipeline",
                        "id": "3652397000000006787"
                    },
                    "actual_value": "Negotiation/Review",
                    "id": "3652397000000006813",
                    "forecast_type": "Open"
                },
                {
                    "display_value": "Closed Won",
                    "sequence_number": 6,
                    "forecast_category": {
                        "name": "Closed",
                        "id": "3652397000000006789"
                    },
                    "actual_value": "Closed Won",
                    "id": "3652397000000006815",
                    "forecast_type": "Closed Won"
                },
                {
                    "display_value": "Closed Lost",
                    "sequence_number": 7,
                    "forecast_category": {
                        "name": "Omitted",
                        "id": "3652397000000006791"
                    },
                    "actual_value": "Closed Lost",
                    "id": "3652397000000006817",
                    "forecast_type": "Closed Lost"
                },
                {
                    "display_value": "Closed-Lost to Competition",
                    "sequence_number": 8,
                    "forecast_category": {
                        "name": "Omitted",
                        "id": "3652397000000006791"
                    },
                    "actual_value": "Closed Lost to Competition",
                    "id": "3652397000000006819",
                    "forecast_type": "Closed Lost"
                }
            ],
            "actual_value": "Pipeline1",
            "id": "3652397000003097007"
        }
    ]
}