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 |
AddOrUpdateGoalResponse200 addGoal(opts)
Add a new goal
Adds a new goal.
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
let apiInstance = new Pipedrive.GoalsApi();
let opts = {
'title': "title_example", // String | Title of the goal.
'assignee': null, // Object | Who is this goal assigned to. It requires the following JSON structure: { \\\"id\\\": \\\"1\\\", \\\"type\\\": \\\"person\\\" }. `type` can be either `person`, `company` or `team`. ID of the assignee person, company or team.
'type': null, // Object | Type of the goal. It requires the following JSON structure: { \\\"name\\\": \\\"deals_started\\\", \\\"params\\\": { \\\"pipeline_id\\\": 1 } }. Type can be one of: `deals_won`,`deals_progressed`,`activities_completed`,`activities_added` or `deals_started`. `params` can include `pipeline_id`, `stage_id` or `activity_type_id`. `stage_id` is related to only `deals_progressed` type of goals and `activity_type_id` to `activities_completed` or `activities_added` types of goals. To track goal in all pipelines set `pipeline_id` as `null`.
'expectedOutcome': null, // Object | Expected outcome of the goal. Expected outcome can be tracked either by `quantity` or by `sum`. It requires the following JSON structure: { \\\"target\\\": \\\"50\\\", \\\"tracking_metric\\\": \\\"quantity\\\" } or { \\\"target\\\": \\\"50\\\", \\\"tracking_metric\\\": \\\"sum\\\", \\\"currency_id\\\": 1 }. `currency_id` should only be added to `sum` type of goals.
'duration': null, // Object | Date when the goal starts and ends. It requires the following JSON structure: { \\\"start\\\": \\\"2019-01-01\\\", \\\"end\\\": \\\"2022-12-31\\\" }. Date in format of YYYY-MM-DD.
'interval': "interval_example" // String | Date when the goal starts and ends. It requires the following JSON structure: { \\\"start\\\": \\\"2019-01-01\\\", \\\"end\\\": \\\"2022-12-31\\\" }. Date in format of YYYY-MM-DD.
};
apiInstance.addGoal(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
title | String | Title of the goal. | [optional] |
assignee | Object | Who is this goal assigned to. It requires the following JSON structure: { \"id\": \"1\", \"type\": \"person\" }. `type` can be either `person`, `company` or `team`. ID of the assignee person, company or team. | [optional] |
type | Object | Type of the goal. It requires the following JSON structure: { \"name\": \"deals_started\", \"params\": { \"pipeline_id\": 1 } }. Type can be one of: `deals_won`,`deals_progressed`,`activities_completed`,`activities_added` or `deals_started`. `params` can include `pipeline_id`, `stage_id` or `activity_type_id`. `stage_id` is related to only `deals_progressed` type of goals and `activity_type_id` to `activities_completed` or `activities_added` types of goals. To track goal in all pipelines set `pipeline_id` as `null`. | [optional] |
expectedOutcome | Object | Expected outcome of the goal. Expected outcome can be tracked either by `quantity` or by `sum`. It requires the following JSON structure: { \"target\": \"50\", \"tracking_metric\": \"quantity\" } or { \"target\": \"50\", \"tracking_metric\": \"sum\", \"currency_id\": 1 }. `currency_id` should only be added to `sum` type of goals. | [optional] |
duration | Object | Date when the goal starts and ends. It requires the following JSON structure: { \"start\": \"2019-01-01\", \"end\": \"2022-12-31\" }. Date in format of YYYY-MM-DD. | [optional] |
interval | String | Date when the goal starts and ends. It requires the following JSON structure: { \"start\": \"2019-01-01\", \"end\": \"2022-12-31\" }. Date in format of YYYY-MM-DD. | [optional] |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
DeleteGoalResponse200 deleteGoal(id)
Delete existing goal
Marks goal as deleted.
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
let apiInstance = new Pipedrive.GoalsApi();
let id = "id_example"; // String | ID of the goal to be deleted.
apiInstance.deleteGoal(id).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | String | ID of the goal to be deleted. |
- Content-Type: Not defined
- Accept: application/json
GetGoalResultResponse200 getGoalResult(id, periodStart, periodEnd)
Get result of a goal
Gets progress of a goal for specified period.
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
let apiInstance = new Pipedrive.GoalsApi();
let id = "id_example"; // String | ID of the goal that the results are looked for.
let periodStart = new Date("2013-10-20"); // Date | Start date of the period for which to find progress of a goal. Date in format of YYYY-MM-DD.
let periodEnd = new Date("2013-10-20"); // Date | End date of the period for which to find progress of a goal. Date in format of YYYY-MM-DD.
apiInstance.getGoalResult(id, periodStart, periodEnd).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | String | ID of the goal that the results are looked for. | |
periodStart | Date | Start date of the period for which to find progress of a goal. Date in format of YYYY-MM-DD. | |
periodEnd | Date | End date of the period for which to find progress of a goal. Date in format of YYYY-MM-DD. |
- Content-Type: Not defined
- Accept: application/json
GetGoalsResponse200 getGoals(opts)
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.
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
let apiInstance = new Pipedrive.GoalsApi();
let opts = {
'typeName': "typeName_example", // String | Type of the goal. If provided, everyone's goals will be returned.
'title': "title_example", // String | Title of the goal.
'isActive': true, // Boolean | Whether goal is active or not.
'assigneeId': 56, // Number | ID of the user who's goal to fetch. When omitted, only your goals will be returned.
'assigneeType': "assigneeType_example", // String | Type of the goal's assignee. If provided, everyone's goals will be returned.
'expectedOutcomeTarget': 3.4, // Number | Numeric value of the outcome. If provided, everyone's goals will be returned.
'expectedOutcomeTrackingMetric': "expectedOutcomeTrackingMetric_example", // String | Tracking metric of the expected outcome of the goal. If provided, everyone's goals will be returned.
'expectedOutcomeCurrencyId': 56, // Number | 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.
'typeParamsPipelineId': 56, // Number | ID of the pipeline or `null` for all pipelines. If provided, everyone's goals will be returned.
'typeParamsStageId': 56, // Number | ID of the stage. Applicable to only `deals_progressed` type of goals. If provided, everyone's goals will be returned.
'typeParamsActivityTypeId': 56, // Number | ID of the activity type. Applicable to only `activities_completed` or `activities_added` types of goals. If provided, everyone's goals will be returned.
'periodStart': new Date("2013-10-20"), // Date | 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.
'periodEnd': new Date("2013-10-20") // Date | End date of the period for which to find goals. Date in format of YYYY-MM-DD.
};
apiInstance.getGoals(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
typeName | String | Type of the goal. If provided, everyone's goals will be returned. | [optional] |
title | String | Title of the goal. | [optional] |
isActive | Boolean | Whether goal is active or not. | [optional] [default to true] |
assigneeId | Number | ID of the user who's goal to fetch. When omitted, only your goals will be returned. | [optional] |
assigneeType | String | Type of the goal's assignee. If provided, everyone's goals will be returned. | [optional] |
expectedOutcomeTarget | Number | Numeric value of the outcome. If provided, everyone's goals will be returned. | [optional] |
expectedOutcomeTrackingMetric | String | Tracking metric of the expected outcome of the goal. If provided, everyone's goals will be returned. | [optional] |
expectedOutcomeCurrencyId | Number | 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] |
typeParamsPipelineId | Number | ID of the pipeline or `null` for all pipelines. If provided, everyone's goals will be returned. | [optional] |
typeParamsStageId | Number | ID of the stage. Applicable to only `deals_progressed` type of goals. If provided, everyone's goals will be returned. | [optional] |
typeParamsActivityTypeId | Number | ID of the activity type. Applicable to only `activities_completed` or `activities_added` types of goals. If provided, everyone's goals will be returned. | [optional] |
periodStart | Date | 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] |
periodEnd | Date | End date of the period for which to find goals. Date in format of YYYY-MM-DD. | [optional] |
- Content-Type: Not defined
- Accept: application/json
AddOrUpdateGoalResponse200 updateGoal(id, opts)
Update existing goal
Updates existing goal.
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
let apiInstance = new Pipedrive.GoalsApi();
let id = "id_example"; // String | ID of the goal to be updated.
let opts = {
'title': "title_example", // String | Title of the goal.
'assignee': null, // Object | Who is this goal assigned to. It requires the following JSON structure: { \\\"id\\\": \\\"1\\\", \\\"type\\\": \\\"person\\\" }. `type` can be either `person`, `company` or `team`. ID of the assignee person, company or team.
'type': null, // Object | Type of the goal. It requires the following JSON structure: { \\\"name\\\": \\\"deals_started\\\", \\\"params\\\": { \\\"pipeline_id\\\": 1 } }. Type can be one of: `deals_won`,`deals_progressed`,`activities_completed`,`activities_added` or `deals_started`. `params` can include `pipeline_id`, `stage_id` or `activity_type_id`. `stage_id` is related to only `deals_progressed` type of goals and `activity_type_id` to `activities_completed` or `activities_added` types of goals. To track goal in all pipelines set `pipeline_id` as `null`.
'expectedOutcome': null, // Object | Expected outcome of the goal. Expected outcome can be tracked either by `quantity` or by `sum`. It requires the following JSON structure: { \\\"target\\\": \\\"50\\\", \\\"tracking_metric\\\": \\\"quantity\\\" } or { \\\"target\\\": \\\"50\\\", \\\"tracking_metric\\\": \\\"sum\\\", \\\"currency_id\\\": 1 }. `currency_id` should only be added to `sum` type of goals.
'duration': null, // Object | Date when the goal starts and ends. It requires the following JSON structure: { \\\"start\\\": \\\"2019-01-01\\\", \\\"end\\\": \\\"2022-12-31\\\" }. Date in format of YYYY-MM-DD.
'interval': "interval_example" // String | Date when the goal starts and ends. It requires the following JSON structure: { \\\"start\\\": \\\"2019-01-01\\\", \\\"end\\\": \\\"2022-12-31\\\" }. Date in format of YYYY-MM-DD.
};
apiInstance.updateGoal(id, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | String | ID of the goal to be updated. | |
title | String | Title of the goal. | [optional] |
assignee | Object | Who is this goal assigned to. It requires the following JSON structure: { \"id\": \"1\", \"type\": \"person\" }. `type` can be either `person`, `company` or `team`. ID of the assignee person, company or team. | [optional] |
type | Object | Type of the goal. It requires the following JSON structure: { \"name\": \"deals_started\", \"params\": { \"pipeline_id\": 1 } }. Type can be one of: `deals_won`,`deals_progressed`,`activities_completed`,`activities_added` or `deals_started`. `params` can include `pipeline_id`, `stage_id` or `activity_type_id`. `stage_id` is related to only `deals_progressed` type of goals and `activity_type_id` to `activities_completed` or `activities_added` types of goals. To track goal in all pipelines set `pipeline_id` as `null`. | [optional] |
expectedOutcome | Object | Expected outcome of the goal. Expected outcome can be tracked either by `quantity` or by `sum`. It requires the following JSON structure: { \"target\": \"50\", \"tracking_metric\": \"quantity\" } or { \"target\": \"50\", \"tracking_metric\": \"sum\", \"currency_id\": 1 }. `currency_id` should only be added to `sum` type of goals. | [optional] |
duration | Object | Date when the goal starts and ends. It requires the following JSON structure: { \"start\": \"2019-01-01\", \"end\": \"2022-12-31\" }. Date in format of YYYY-MM-DD. | [optional] |
interval | String | Date when the goal starts and ends. It requires the following JSON structure: { \"start\": \"2019-01-01\", \"end\": \"2022-12-31\" }. Date in format of YYYY-MM-DD. | [optional] |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json