Запуск аудита (AuditSite.start)
Метод AuditSite.start запускает аудит по настройкам, сохраненным ранее.
Параметры запроса | ||
Параметр | Значение | Описание |
id | any number or string | Идентификатор запроса |
method | AuditSite.start | Название метода API |
params | {...} | Массив с параметрами |
projectId (обязательный) | Project id |
Идентификатор проекта аудита
|
Параметры ответа | |
Параметр | Описание |
id | Идентификатор запроса |
result | Инкапсулирует в себе ответ. Null - команда запуска аудита выполнена уcпешно |
{
"id":1,
"method": "auditProjectReport.start",
"params":{
"projectId":174937
},
"jsonrpc": "2.0"
}
{
"id": "1",
"result": null,
"jsonrpc": "2.0"
}
Exception, если уже есть запущенный аудит:
{
"id": "1",
"error": {
"code": -32124,
"message": "Can't start Audit. Already have one ",
"data": {
}
},
"jsonrpc": "2.0"
}
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('http://api.serpstat.com/v4/?token={{token}}');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
"id": "",
"method": "AuditSite.start",
"params": {
"projectId": 174937
}
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Content-Type' => 'application/json'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
{
"id": {{any_num_or_string}},
"method": "AuditSite.start",
"params": {
"projectId" : {{projectId}}
}
}