Skip to content

Latest commit

 

History

History
367 lines (259 loc) · 15.1 KB

GoalsApi.md

File metadata and controls

367 lines (259 loc) · 15.1 KB

Pipedrive\GoalsApi

All URIs are relative to https://api.pipedrive.com/v1.

Method HTTP request Description
addGoal() POST /goals Add a new goal
deleteGoal() DELETE /goals/{id} Delete existing goal
getGoalResult() GET /goals/{id}/results Get result of a goal
getGoals() GET /goals/find Find goals
updateGoal() PUT /goals/{id} Update existing goal

addGoal()

addGoal($new_goal): \Pipedrive\Model\UpsertGoalResponse

Add a new goal

Adds a new goal. Along with adding a new goal, a report is created to track the progress of your goal.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');

// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Pipedrive\Api\GoalsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$new_goal = new \Pipedrive\Model\NewGoal(); // \Pipedrive\Model\NewGoal

try {
    $result = $apiInstance->addGoal($new_goal);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling GoalsApi->addGoal: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
new_goal \Pipedrive\Model\NewGoal [optional]

Return type

\Pipedrive\Model\UpsertGoalResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteGoal()

deleteGoal($id): \Pipedrive\Model\DeleteGoalResponse

Delete existing goal

Marks a goal as deleted.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');

// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Pipedrive\Api\GoalsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$id = 'id_example'; // string | The ID of the goal

try {
    $result = $apiInstance->deleteGoal($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling GoalsApi->deleteGoal: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
id string The ID of the goal

Return type

\Pipedrive\Model\DeleteGoalResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getGoalResult()

getGoalResult($id, $period_start, $period_end): \Pipedrive\Model\GetGoalResultResponse

Get result of a goal

Gets the progress of a goal for the specified period.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');

// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Pipedrive\Api\GoalsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$id = 'id_example'; // string | The ID of the goal that the results are looked for
$period_start = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | The start date of the period for which to find the goal's progress. Format: YYYY-MM-DD. This date must be the same or after the goal duration start date.
$period_end = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | The end date of the period for which to find the goal's progress. Format: YYYY-MM-DD. This date must be the same or before the goal duration end date.

try {
    $result = $apiInstance->getGoalResult($id, $period_start, $period_end);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling GoalsApi->getGoalResult: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
id string The ID of the goal that the results are looked for
period_start \DateTime The start date of the period for which to find the goal's progress. Format: YYYY-MM-DD. This date must be the same or after the goal duration start date.
period_end \DateTime The end date of the period for which to find the goal's progress. Format: YYYY-MM-DD. This date must be the same or before the goal duration end date.

Return type

\Pipedrive\Model\GetGoalResultResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getGoals()

getGoals($type_name, $title, $is_active, $assignee_id, $assignee_type, $expected_outcome_target, $expected_outcome_tracking_metric, $expected_outcome_currency_id, $type_params_pipeline_id, $type_params_stage_id, $type_params_activity_type_id, $period_start, $period_end): \Pipedrive\Model\GetGoalsResponse

Find goals

Returns data about goals based on criteria. For searching, append {searchField}={searchValue} to the URL, where searchField can be any one of the lowest-level fields in dot-notation (e.g. type.params.pipeline_id; title). searchValue should be the value you are looking for on that field. Additionally, is_active=<true|false> can be provided to search for only active/inactive goals. When providing period.start, period.end must also be provided and vice versa.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');

// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Pipedrive\Api\GoalsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$type_name = 'type_name_example'; // string | The type of the goal. If provided, everyone's goals will be returned.
$title = 'title_example'; // string | The title of the goal
$is_active = true; // bool | Whether the goal is active or not
$assignee_id = 56; // int | The ID of the user who's goal to fetch. When omitted, only your goals will be returned.
$assignee_type = 'assignee_type_example'; // string | The type of the goal's assignee. If provided, everyone's goals will be returned.
$expected_outcome_target = 3.4; // float | The numeric value of the outcome. If provided, everyone's goals will be returned.
$expected_outcome_tracking_metric = 'expected_outcome_tracking_metric_example'; // string | The tracking metric of the expected outcome of the goal. If provided, everyone's goals will be returned.
$expected_outcome_currency_id = 56; // int | The numeric ID of the goal's currency. Only applicable to goals with `expected_outcome.tracking_metric` with value `sum`. If provided, everyone's goals will be returned.
$type_params_pipeline_id = array(56); // int[] | An array of pipeline IDs or `null` for all pipelines. If provided, everyone's goals will be returned.
$type_params_stage_id = 56; // int | The ID of the stage. Applicable to only `deals_progressed` type of goals. If provided, everyone's goals will be returned.
$type_params_activity_type_id = array(56); // int[] | An array of IDs or `null` for all activity types. Only applicable for `activities_completed` and/or `activities_added` types of goals. If provided, everyone's goals will be returned.
$period_start = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | The start date of the period for which to find goals. Date in format of YYYY-MM-DD. When `period.start` is provided, `period.end` must be provided too.
$period_end = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | The end date of the period for which to find goals. Date in format of YYYY-MM-DD.

try {
    $result = $apiInstance->getGoals($type_name, $title, $is_active, $assignee_id, $assignee_type, $expected_outcome_target, $expected_outcome_tracking_metric, $expected_outcome_currency_id, $type_params_pipeline_id, $type_params_stage_id, $type_params_activity_type_id, $period_start, $period_end);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling GoalsApi->getGoals: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
type_name string The type of the goal. If provided, everyone's goals will be returned. [optional]
title string The title of the goal [optional]
is_active bool Whether the goal is active or not [optional] [default to true]
assignee_id int The ID of the user who's goal to fetch. When omitted, only your goals will be returned. [optional]
assignee_type string The type of the goal's assignee. If provided, everyone's goals will be returned. [optional]
expected_outcome_target float The numeric value of the outcome. If provided, everyone's goals will be returned. [optional]
expected_outcome_tracking_metric string The tracking metric of the expected outcome of the goal. If provided, everyone's goals will be returned. [optional]
expected_outcome_currency_id int The numeric ID of the goal's currency. Only applicable to goals with `expected_outcome.tracking_metric` with value `sum`. If provided, everyone's goals will be returned. [optional]
type_params_pipeline_id int[] An array of pipeline IDs or `null` for all pipelines. If provided, everyone's goals will be returned. [optional]
type_params_stage_id int The ID of the stage. Applicable to only `deals_progressed` type of goals. If provided, everyone's goals will be returned. [optional]
type_params_activity_type_id int[] An array of IDs or `null` for all activity types. Only applicable for `activities_completed` and/or `activities_added` types of goals. If provided, everyone's goals will be returned. [optional]
period_start \DateTime The start date of the period for which to find goals. Date in format of YYYY-MM-DD. When `period.start` is provided, `period.end` must be provided too. [optional]
period_end \DateTime The end date of the period for which to find goals. Date in format of YYYY-MM-DD. [optional]

Return type

\Pipedrive\Model\GetGoalsResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateGoal()

updateGoal($id, $basic_goal): \Pipedrive\Model\UpsertGoalResponse

Update existing goal

Updates an existing goal.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: api_key
$config = (new Pipedrive\Configuration())->setApiKey('api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = (new Pipedrive\Configuration())->setApiKeyPrefix('api_token', 'Bearer');

// Configure OAuth2 access token for authorization: oauth2
$config = (new Pipedrive\Configuration())->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Pipedrive\Api\GoalsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$id = 'id_example'; // string | The ID of the goal
$basic_goal = new \Pipedrive\Model\BasicGoal(); // \Pipedrive\Model\BasicGoal

try {
    $result = $apiInstance->updateGoal($id, $basic_goal);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling GoalsApi->updateGoal: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
id string The ID of the goal
basic_goal \Pipedrive\Model\BasicGoal [optional]

Return type

\Pipedrive\Model\UpsertGoalResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]