Update a cost centre
curl --request PATCH \
--url https://coreapi.io/accounting/cost-centres/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/merge-patch+json' \
--data '
{
"name": "Cost Centre",
"type": "KOST1",
"status": "active"
}
'import requests
url = "https://coreapi.io/accounting/cost-centres/{id}"
payload = {
"name": "Cost Centre",
"type": "KOST1",
"status": "active"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/merge-patch+json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/merge-patch+json'
},
body: JSON.stringify({name: 'Cost Centre', type: 'KOST1', status: 'active'})
};
fetch('https://coreapi.io/accounting/cost-centres/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/accounting/cost-centres/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Cost Centre',
'type' => 'KOST1',
'status' => 'active'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/merge-patch+json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"name": "Cost Centre",
"type": "KOST1",
"status": "active",
"id": "ad8f1c9c-4f0a-4e1a-8b1a-9c4d9c4d9c4d",
"code": "CC",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
}Cost Centre
Update a cost centre
Update a cost centre. A cost centre can be of type KOST1 or KOST2 and must have a unique code.
Required permissions:cost-centre:writePATCH
/
accounting
/
cost-centres
/
{id}
Update a cost centre
curl --request PATCH \
--url https://coreapi.io/accounting/cost-centres/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/merge-patch+json' \
--data '
{
"name": "Cost Centre",
"type": "KOST1",
"status": "active"
}
'import requests
url = "https://coreapi.io/accounting/cost-centres/{id}"
payload = {
"name": "Cost Centre",
"type": "KOST1",
"status": "active"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/merge-patch+json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/merge-patch+json'
},
body: JSON.stringify({name: 'Cost Centre', type: 'KOST1', status: 'active'})
};
fetch('https://coreapi.io/accounting/cost-centres/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/accounting/cost-centres/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Cost Centre',
'type' => 'KOST1',
'status' => 'active'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/merge-patch+json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"name": "Cost Centre",
"type": "KOST1",
"status": "active",
"id": "ad8f1c9c-4f0a-4e1a-8b1a-9c4d9c4d9c4d",
"code": "CC",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
}Autorisierungen
Body
application/merge-patch+jsonapplication/vnd.api+json
The updated CostCentre resource
Antwort
CostCentre resource updated
War diese Seite hilfreich?