getLeads method¶
getLeads¶
The method lets you get a list of deals, including those created via the R7K12 service. The method returns no more than 10000 records per call; each response includes the “totalResult” parameter with the total number of results. Method: GET URL: https://api.r7k12.com/{{TOKEN}}/getLeads Parameters: Table 1 Table 1
| Parameter | Type | Required | Description |
| id | string | No | Unique deal ID in the CRM. When this parameter is used, the response will contain the deal with the specified ID (if it exists). |
| lastModified | string | No | Date of the last change of the deal. Format: - YYYY-MM-DD HH:MM:SS - YYYY-MM-DD. If this parameter is specified, the response will include only the deals that were changed/created after the specified date. |
| fields | array [string] | No | List of fields to return in the response. If the parameter is not set, only IDs are returned. Available fields: - id - deal ID - r7k12id - “visit” ID - name - deal name - status - deal status - type - inquiry type - dateCreate - creation date (UNIX) - lastModified - change date - price - deal amount - cost - deal cost of goods - clientId - CRM client ID - manager - ID of the manager responsible for the deal - products - array of products - fields - additional deal fields |
| limit | integer | No | Number of records to return in the result (default “10000”) |
| page | integer | No | Number of the page to return (default “1”) |
Request example:
define('TOKEN','XXXXXXXXX');
$data = @file_get_contents(
'https://api.r7k12.com/'.TOKEN.'/getLeads?'.
http_build_query(
[
'lastModified' => '2017-11-11',
'fields' => [
'id',
'status',
'price',
'cost',
'fields'
],
'limit'=> 1
]
)
);
Response:
{
"page" : 1,
"totalResult": 156,
"data": [
{
"id" : "1",
"status" : "587",
"price" : 0,
"cost" : 0,
"fields" : {
"source1" : "yandex",
"source2" : "organic",
"source3" : "(not set)"
}
}
]
}