Добавление
Добавление новой сделки
POST
https://do.myfreshcloud.com/deal/insert
Request Body
Name | Type | Description |
---|---|---|
deal* | JSON |
{
"status": "success",
"error": null,
"code": "0",
"rows": 1,
"pages": 1,
"page": 1,
"value": "1"
}
JSON
Все доступные параметры нового объекта
name - * Наименование компании
company_id - * Код контрагента
type_id - * Код типа сделки
status_id - * Код статуса сделки
user_id - * Код ответственного за сделку
sum - Сумма сделки
date_start - * Дата начала
date_finish - * Дата завершения
note - Примечание к сделке
Goods - Список товарных позиций
{
"name":"test-deal-API",
"company_id":1,
"type_id":1,
"status_id":5,
"user_id":37,
"sum":100,
"date_start":"2022-01-21",
"date_finish":"2022-01-22",
"note":"test-Note",
"Goods" : [{
"goods_id" : 0,
"discription" : "test-good-API",
"code" : "0000001",
"price" : 2000,
"discount" : 0,
"qnt" : 1,
"note" : "test-note-API"
}]
}
Обязательные параметры name company_id type_id (Код типа сдедки, можно взять в справчнике) user_id (Код статума сделки, можно взять в справчнике) date_start date_finish
Пример
curl --location --request POST 'https://do.myfreshcloud.com/deal/insert' \
--header 'Authorization: Bearer XXXX-XXXXXXX-XXXXXXX \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "test-deal-API",
"company_id": 1,
"type_id": 1,
"status_id": 5,
"user_id": 37,
"sum": 100,
"date_start": "2022-01-21",
"date_finish": "2022-01-22",
"note": "test-Note",
"Goods": [
{
"goods_id": 0,
"discription": "test-good-API",
"code": "0000001",
"price": 2000,
"discount": 0,
"qnt": 1,
"note": "test-note-API"
}
]
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://do.myfreshcloud.com/deal/insert',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"name": "test-deal-API",
"company_id": 1,
"type_id": 1,
"status_id": 5,
"user_id": 37,
"sum": 100,
"date_start": "2022-01-21",
"date_finish": "2022-01-22",
"note": "test-Note",
"Goods": [
{
"goods_id": 0,
"discription": "test-good-API",
"code": "0000001",
"price": 2000,
"discount": 0,
"qnt": 1,
"note": "test-note-API"
}
]
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer XXXX-XXXXXXX-XXXXXXX',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://do.myfreshcloud.com/deal/insert',
'headers': {
'Authorization': 'Bearer XXX-XXXXXXXX-XXXXXX',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "test-deal-API",
"company_id": 1,
"type_id": 1,
"status_id": 5,
"user_id": 37,
"sum": 100,
"date_start": "2022-01-21",
"date_finish": "2022-01-22",
"note": "test-Note",
"Goods": [
{
"goods_id": 0,
"discription": "test-good-API",
"code": "0000001",
"price": 2000,
"discount": 0,
"qnt": 1,
"note": "test-note-API"
}
]
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Last updated