Добавление
Добавление нового контрагента
POST https://do.myfreshcloud.com/company/insert
Request Body
Name
Type
Description
company*
JSON
{
"status": "success",
"error": null,
"code": "0",
"rows": 1,
"pages": 1,
"page": 1,
"value": "1"
}JSON
{
"name" : "Apple",
"type_id" : 1,
"user_id" : 37,
"Contacts": [
{
"first_name": "John",
"last_name": "Smith",
"post": "CEO",
"note": "The main decision maker",
"status_id": 1,
"Emails": [
{
"email": "[email protected]"
}
],
"Phones": [
{
"phone": "+1 234 567890",
"descr": "mobile"
}
]
}
],
"Emails": [
{
"email": "[email protected]"
}
],
"Phones": [
{
"phone": "+1 123 345678",
"descr": "Reception"
}
]
}
Пример
curl --location --request POST 'https://do.myfreshcloud.com/company/insert' \
--header 'Authorization: Bearer XXXX-XXXXXXX-XXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"name" : "Apple",
"type_id" : 1,
"user_id" : 37,
"Contacts": [
{
"first_name": "John",
"last_name": "Smith",
"post": "CEO",
"note": "The main decision maker",
"status_id": 1,
"Emails": [
{
"email": "[email protected]"
}
],
"Phones": [
{
"phone": "+1 234 567890",
"descr": "mobile"
}
]
}
],
"Emails": [
{
"email": "[email protected]"
}
],
"Phones": [
{
"phone": "+1 123 345678",
"descr": "Reception"
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://do.myfreshcloud.com/company/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" : "Apple",
"type_id" : 1,
"user_id" : 37,
"Contacts": [
{
"first_name": "John",
"last_name": "Smith",
"post": "CEO",
"note": "The main decision maker",
"status_id": 1,
"Emails": [
{
"email": "[email protected]"
}
],
"Phones": [
{
"phone": "+1 234 567890",
"descr": "mobile"
}
]
}
],
"Emails": [
{
"email": "[email protected]"
}
],
"Phones": [
{
"phone": "+1 123 345678",
"descr": "Reception"
}
]
}
',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer XXXXX-XXXXXXX-XXXXXXXXX',
'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/company/insert',
'headers': {
'Authorization': 'Bearer XXXX-XXXXXXX-XXXXXXX',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Apple",
"type_id": 1,
"user_id": 37,
"Contacts": [
{
"first_name": "John",
"last_name": "Smith",
"post": "CEO",
"note": "The main decision maker",
"status_id": 1,
"Emails": [
{
"email": "[email protected]"
}
],
"Phones": [
{
"phone": "+1 234 567890",
"descr": "mobile"
}
]
}
],
"Emails": [
{
"email": "[email protected]"
}
],
"Phones": [
{
"phone": "+1 123 345678",
"descr": "Reception"
}
]
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});Справочники
Для контрагентовПользователиОтвет
{
"status": "success",
"error": null,
"code": "0",
"rows": 1,
"pages": 1,
"page": 1,
"value": "1"
}
// value - ID идентификатор нового контрагентаLast updated
Was this helpful?