Skip to content

Latest commit

 

History

History
569 lines (398 loc) · 18.9 KB

FilesApi.md

File metadata and controls

569 lines (398 loc) · 18.9 KB

Pipedrive\FilesApi

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

Method HTTP request Description
addFile() POST /files Add file
addFileAndLinkIt() POST /files/remote Create a remote file and link it to an item
deleteFile() DELETE /files/{id} Delete a file
downloadFile() GET /files/{id}/download Download one file
getFile() GET /files/{id} Get one file
getFiles() GET /files Get all files
linkFileToItem() POST /files/remoteLink Link a remote file to an item
updateFile() PUT /files/{id} Update file details

addFile()

addFile($file, $deal_id, $person_id, $org_id, $product_id, $activity_id, $lead_id): \Pipedrive\Model\AddFile

Add file

Lets you upload a file and associate it with a deal, person, organization, activity, product or lead. For more information, see the tutorial for <a href="https://pipedrive.readme.io/docs/adding-a-file\" target="_blank" rel="noopener noreferrer">adding a file.

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\FilesApi(
    // 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
);
$file = "/path/to/file.txt"; // \SplFileObject | A single file, supplied in the multipart/form-data encoding and contained within the given boundaries
$deal_id = 56; // int | The ID of the deal to associate file(s) with
$person_id = 56; // int | The ID of the person to associate file(s) with
$org_id = 56; // int | The ID of the organization to associate file(s) with
$product_id = 56; // int | The ID of the product to associate file(s) with
$activity_id = 56; // int | The ID of the activity to associate file(s) with
$lead_id = 'lead_id_example'; // string | The ID of the lead to associate file(s) with

try {
    $result = $apiInstance->addFile($file, $deal_id, $person_id, $org_id, $product_id, $activity_id, $lead_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FilesApi->addFile: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
file \SplFileObject**\SplFileObject** A single file, supplied in the multipart/form-data encoding and contained within the given boundaries
deal_id int The ID of the deal to associate file(s) with [optional]
person_id int The ID of the person to associate file(s) with [optional]
org_id int The ID of the organization to associate file(s) with [optional]
product_id int The ID of the product to associate file(s) with [optional]
activity_id int The ID of the activity to associate file(s) with [optional]
lead_id string The ID of the lead to associate file(s) with [optional]

Return type

\Pipedrive\Model\AddFile

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

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

addFileAndLinkIt()

addFileAndLinkIt($file_type, $title, $item_type, $item_id, $remote_location): \Pipedrive\Model\CreateRemoteFileAndLinkItToItem

Create a remote file and link it to an item

Creates a new empty file in the remote location (googledrive) that will be linked to the item you supply. For more information, see the tutorial for <a href="https://pipedrive.readme.io/docs/adding-a-remote-file\" target="_blank" rel="noopener noreferrer">adding a remote file.

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\FilesApi(
    // 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
);
$file_type = 'file_type_example'; // string | The file type
$title = 'title_example'; // string | The title of the file
$item_type = 'item_type_example'; // string | The item type
$item_id = 56; // int | The ID of the item to associate the file with
$remote_location = 'remote_location_example'; // string | The location type to send the file to. Only `googledrive` is supported at the moment.

try {
    $result = $apiInstance->addFileAndLinkIt($file_type, $title, $item_type, $item_id, $remote_location);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FilesApi->addFileAndLinkIt: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
file_type string The file type
title string The title of the file
item_type string The item type
item_id int The ID of the item to associate the file with
remote_location string The location type to send the file to. Only `googledrive` is supported at the moment.

Return type

\Pipedrive\Model\CreateRemoteFileAndLinkItToItem

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

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

deleteFile()

deleteFile($id): \Pipedrive\Model\DeleteFile

Delete a file

Marks a file as deleted. After 30 days, the file will be permanently 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\FilesApi(
    // 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 = 56; // int | The ID of the file

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

Parameters

Name Type Description Notes
id int The ID of the file

Return type

\Pipedrive\Model\DeleteFile

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]

downloadFile()

downloadFile($id): string

Download one file

Initializes a file download.

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\FilesApi(
    // 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 = 56; // int | The ID of the file

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

Parameters

Name Type Description Notes
id int The ID of the file

Return type

string

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/octet-stream

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

getFile()

getFile($id): \Pipedrive\Model\GetOneFile

Get one file

Returns data about a specific file.

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\FilesApi(
    // 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 = 56; // int | The ID of the file

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

Parameters

Name Type Description Notes
id int The ID of the file

Return type

\Pipedrive\Model\GetOneFile

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]

getFiles()

getFiles($start, $limit, $sort): \Pipedrive\Model\GetAllFiles

Get all files

Returns data about all files.

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\FilesApi(
    // 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
);
$start = 0; // int | Pagination start
$limit = 56; // int | Items shown per page
$sort = 'sort_example'; // string | The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `product_id`, `add_time`, `update_time`, `file_name`, `file_type`, `file_size`, `comment`.

try {
    $result = $apiInstance->getFiles($start, $limit, $sort);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FilesApi->getFiles: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
start int Pagination start [optional] [default to 0]
limit int Items shown per page [optional]
sort string The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `product_id`, `add_time`, `update_time`, `file_name`, `file_type`, `file_size`, `comment`. [optional]

Return type

\Pipedrive\Model\GetAllFiles

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]

linkFileToItem()

linkFileToItem($item_type, $item_id, $remote_id, $remote_location): \Pipedrive\Model\LinkRemoteFileToItem

Link a remote file to an item

Links an existing remote file (googledrive) to the item you supply. For more information, see the tutorial for <a href="https://pipedrive.readme.io/docs/adding-a-remote-file\" target="_blank" rel="noopener noreferrer">adding a remote file.

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\FilesApi(
    // 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
);
$item_type = 'item_type_example'; // string | The item type
$item_id = 56; // int | The ID of the item to associate the file with
$remote_id = 'remote_id_example'; // string | The remote item ID
$remote_location = 'remote_location_example'; // string | The location type to send the file to. Only `googledrive` is supported at the moment.

try {
    $result = $apiInstance->linkFileToItem($item_type, $item_id, $remote_id, $remote_location);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FilesApi->linkFileToItem: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
item_type string The item type
item_id int The ID of the item to associate the file with
remote_id string The remote item ID
remote_location string The location type to send the file to. Only `googledrive` is supported at the moment.

Return type

\Pipedrive\Model\LinkRemoteFileToItem

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

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

updateFile()

updateFile($id, $name, $description): \Pipedrive\Model\UpdateFile

Update file details

Updates the properties of a file.

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\FilesApi(
    // 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 = 56; // int | The ID of the file
$name = 'name_example'; // string | The visible name of the file
$description = 'description_example'; // string | The description of the file

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

Parameters

Name Type Description Notes
id int The ID of the file
name string The visible name of the file [optional]
description string The description of the file [optional]

Return type

\Pipedrive\Model\UpdateFile

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

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