Skip to content

Latest commit

 

History

History
721 lines (501 loc) · 23.8 KB

ProductsApi.md

File metadata and controls

721 lines (501 loc) · 23.8 KB

Pipedrive.ProductsApi

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

Method HTTP request Description
addProduct POST /products Add a product
addProductFollower POST /products/{id}/followers Add a follower to a product
deleteProduct DELETE /products/{id} Delete a product
deleteProductFollower DELETE /products/{id}/followers/{follower_id} Delete a follower from a product
getProduct GET /products/{id} Get one product
getProductDeals GET /products/{id}/deals Get deals where a product is attached to
getProductFiles GET /products/{id}/files List files attached to a product
getProductFollowers GET /products/{id}/followers List followers of a product
getProductUsers GET /products/{id}/permittedUsers List permitted users
getProducts GET /products Get all products
searchProducts GET /products/search Search products
updateProduct PUT /products/{id} Update a product

addProduct

ProductResponse addProduct(opts)

Add a product

Adds a new product to the Products inventory. For more information, see the tutorial for <a href=&quot;https://pipedrive.readme.io/docs/adding-a-product\" target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;>adding a product</a>.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let opts = Pipedrive.AddProductRequestBody.constructFromObject({
  // Properties that you want to update
});
apiInstance.addProduct(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
AddProductRequestBody AddProductRequestBody [optional]

Return type

ProductResponse

Authorization

api_key, oauth2

HTTP request headers

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

addProductFollower

NewFollowerResponse addProductFollower(id, opts)

Add a follower to a product

Adds a follower to a product.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let id = 56; // Number | The ID of the product
let opts = Pipedrive.AddProductFollowerRequest.constructFromObject({
  // Properties that you want to update
});
apiInstance.addProductFollower(id, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number The ID of the product
AddProductFollowerRequest AddProductFollowerRequest [optional]

Return type

NewFollowerResponse

Authorization

api_key, oauth2

HTTP request headers

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

deleteProduct

DeleteProductResponse deleteProduct(id)

Delete a product

Marks a product as deleted. After 30 days, the product will be permanently deleted.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let id = 56; // Number | The ID of the product
apiInstance.deleteProduct(id).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number The ID of the product

Return type

DeleteProductResponse

Authorization

api_key, oauth2

HTTP request headers

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

deleteProductFollower

DeleteProductFollowerResponse deleteProductFollower(id, followerId)

Delete a follower from a product

Deletes a follower from a product.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let id = 56; // Number | The ID of the product
let followerId = 56; // Number | The ID of the relationship between the follower and the product
apiInstance.deleteProductFollower(id, followerId).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number The ID of the product
follower_id Number The ID of the relationship between the follower and the product

Return type

DeleteProductFollowerResponse

Authorization

api_key, oauth2

HTTP request headers

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

getProduct

ProductResponse getProduct(id)

Get one product

Returns data about a specific product.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let id = 56; // Number | The ID of the product
apiInstance.getProduct(id).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number The ID of the product

Return type

ProductResponse

Authorization

api_key, oauth2

HTTP request headers

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

getProductDeals

ListDealsResponse getProductDeals(id, opts)

Get deals where a product is attached to

Returns data about deals that have a product attached to it.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let id = 56; // Number | The ID of the product
// snake_case as well as camelCase is supported for naming opts properties
let opts = {
  'start': 0, // Number | Pagination start
  'limit': 56, // Number | Items shown per page
  'status': "'all_not_deleted'" // String | Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included.
};
apiInstance.getProductDeals(id, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number The ID of the product
start Number Pagination start [optional] [default to 0]
limit Number Items shown per page [optional]
status String Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. [optional] [default to 'all_not_deleted']

Return type

ListDealsResponse

Authorization

api_key, oauth2

HTTP request headers

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

getProductFiles

ListProductFilesResponse getProductFiles(id, opts)

List files attached to a product

Lists files associated with a product.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let id = 56; // Number | The ID of the product
// snake_case as well as camelCase is supported for naming opts properties
let opts = {
  'start': 0, // Number | Pagination start
  'limit': 56, // Number | Items shown per page
  'sort': "sort_example" // String | The field name and sorting mode (`field_name_1 ASC` or `field_name_1 DESC`). Supported fields: `update_time`, `id`.
};
apiInstance.getProductFiles(id, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number The ID of the product
start Number Pagination start [optional] [default to 0]
limit Number Items shown per page [optional]
sort String The field name and sorting mode (`field_name_1 ASC` or `field_name_1 DESC`). Supported fields: `update_time`, `id`. [optional]

Return type

ListProductFilesResponse

Authorization

api_key, oauth2

HTTP request headers

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

getProductFollowers

ListProductFollowersResponse getProductFollowers(id, opts)

List followers of a product

Lists the followers of a product.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let id = 56; // Number | The ID of the product
// snake_case as well as camelCase is supported for naming opts properties
let opts = {
  'start': 0, // Number | Pagination start
  'limit': 56 // Number | Items shown per page
};
apiInstance.getProductFollowers(id, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number The ID of the product
start Number Pagination start [optional] [default to 0]
limit Number Items shown per page [optional]

Return type

ListProductFollowersResponse

Authorization

api_key, oauth2

HTTP request headers

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

getProductUsers

UserIDs getProductUsers(id)

List permitted users

Lists users permitted to access a product.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let id = 56; // Number | The ID of the product
apiInstance.getProductUsers(id).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number The ID of the product

Return type

UserIDs

Authorization

api_key, oauth2

HTTP request headers

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

getProducts

ProductsResponse getProducts(opts)

Get all products

Returns data about all products.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
// snake_case as well as camelCase is supported for naming opts properties
let opts = {
  'userId': 56, // Number | If supplied, only products owned by the given user will be returned
  'filterId': 56, // Number | The ID of the filter to use
  'ids': [null], // [Number] | An array of integers with the IDs of the products that should be returned in the response
  'firstChar': "firstChar_example", // String | If supplied, only products whose name starts with the specified letter will be returned (case-insensitive)
  'getSummary': true, // Boolean | If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property
  'start': 0, // Number | Pagination start
  'limit': 56 // Number | Items shown per page
};
apiInstance.getProducts(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
user_id Number If supplied, only products owned by the given user will be returned [optional]
filter_id Number The ID of the filter to use [optional]
ids [Number] An array of integers with the IDs of the products that should be returned in the response [optional]
first_char String If supplied, only products whose name starts with the specified letter will be returned (case-insensitive) [optional]
get_summary Boolean If supplied, the response will return the total numbers of products in the `additional_data.summary.total_count` property [optional]
start Number Pagination start [optional] [default to 0]
limit Number Items shown per page [optional]

Return type

ProductsResponse

Authorization

api_key, oauth2

HTTP request headers

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

searchProducts

ProductSearchResponse searchProducts(term, opts)

Search products

Searches all products by name, code and/or custom fields. This endpoint is a wrapper of <a href=&quot;https://developers.pipedrive.com/docs/api/v1/ItemSearch#searchItem\&quot;&gt;/v1/itemSearch&lt;/a> with a narrower OAuth scope.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let term = "term_example"; // String | The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded.
// snake_case as well as camelCase is supported for naming opts properties
let opts = {
  'fields': "fields_example", // String | A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.
  'exactMatch': true, // Boolean | When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive.
  'includeFields': "includeFields_example", // String | Supports including optional fields in the results which are not provided by default
  'start': 0, // Number | Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter.
  'limit': 56 // Number | Items shown per page
};
apiInstance.searchProducts(term, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
term String The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded.
fields String A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=&quot;https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;>here</a>. [optional]
exact_match Boolean When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive. [optional]
include_fields String Supports including optional fields in the results which are not provided by default [optional]
start Number Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. [optional] [default to 0]
limit Number Items shown per page [optional]

Return type

ProductSearchResponse

Authorization

api_key, oauth2

HTTP request headers

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

updateProduct

UpdateProductResponse updateProduct(id, opts)

Update a product

Updates product data.

Example

import Pipedrive from 'pipedrive';
let apiClient = new Pipedrive.ApiClient();
// Configure API key authorization: api_key
let api_key = apiClient.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';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = apiClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new Pipedrive.ProductsApi(apiClient);
let id = 56; // Number | The ID of the product
let opts = Pipedrive.UpdateProductRequestBody.constructFromObject({
  // Properties that you want to update
});
apiInstance.updateProduct(id, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number The ID of the product
UpdateProductRequestBody UpdateProductRequestBody [optional]

Return type

UpdateProductResponse

Authorization

api_key, oauth2

HTTP request headers

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