Update Allocation
curl --request PUT \
--url https://planner.svc.v2.projectcor.com/allocation/updateAllocation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"oldAllocation": {
"userId": 1111,
"companyId": 11,
"resource": {
"entityId": 11111,
"typeId": "Project"
},
"from": "2024-01-01",
"to": "2024-03-31",
"assignedByUserId": 1111,
"allocatedHours": 0
},
"newAllocation": {
"userId": 1111,
"companyId": 11,
"resource": {
"entityId": 11111,
"typeId": "Project"
},
"from": "2024-01-01",
"to": "2024-03-31",
"assignedByUserId": 1111,
"allocatedHours": 10
}
}
'import requests
url = "https://planner.svc.v2.projectcor.com/allocation/updateAllocation"
payload = {
"oldAllocation": {
"userId": 1111,
"companyId": 11,
"resource": {
"entityId": 11111,
"typeId": "Project"
},
"from": "2024-01-01",
"to": "2024-03-31",
"assignedByUserId": 1111,
"allocatedHours": 0
},
"newAllocation": {
"userId": 1111,
"companyId": 11,
"resource": {
"entityId": 11111,
"typeId": "Project"
},
"from": "2024-01-01",
"to": "2024-03-31",
"assignedByUserId": 1111,
"allocatedHours": 10
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
oldAllocation: {
userId: 1111,
companyId: 11,
resource: {entityId: 11111, typeId: 'Project'},
from: '2024-01-01',
to: '2024-03-31',
assignedByUserId: 1111,
allocatedHours: 0
},
newAllocation: {
userId: 1111,
companyId: 11,
resource: {entityId: 11111, typeId: 'Project'},
from: '2024-01-01',
to: '2024-03-31',
assignedByUserId: 1111,
allocatedHours: 10
}
})
};
fetch('https://planner.svc.v2.projectcor.com/allocation/updateAllocation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://planner.svc.v2.projectcor.com/allocation/updateAllocation';
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
oldAllocation: {
userId: 1111,
companyId: 11,
resource: {entityId: 11111, typeId: 'Project'},
from: '2024-01-01',
to: '2024-03-31',
assignedByUserId: 1111,
allocatedHours: 0
},
newAllocation: {
userId: 1111,
companyId: 11,
resource: {entityId: 11111, typeId: 'Project'},
from: '2024-01-01',
to: '2024-03-31',
assignedByUserId: 1111,
allocatedHours: 10
}
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://planner.svc.v2.projectcor.com/allocation/updateAllocation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'oldAllocation' => [
'userId' => 1111,
'companyId' => 11,
'resource' => [
'entityId' => 11111,
'typeId' => 'Project'
],
'from' => '2024-01-01',
'to' => '2024-03-31',
'assignedByUserId' => 1111,
'allocatedHours' => 0
],
'newAllocation' => [
'userId' => 1111,
'companyId' => 11,
'resource' => [
'entityId' => 11111,
'typeId' => 'Project'
],
'from' => '2024-01-01',
'to' => '2024-03-31',
'assignedByUserId' => 1111,
'allocatedHours' => 10
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://planner.svc.v2.projectcor.com/allocation/updateAllocation"
payload := strings.NewReader("{\n \"oldAllocation\": {\n \"userId\": 1111,\n \"companyId\": 11,\n \"resource\": {\n \"entityId\": 11111,\n \"typeId\": \"Project\"\n },\n \"from\": \"2024-01-01\",\n \"to\": \"2024-03-31\",\n \"assignedByUserId\": 1111,\n \"allocatedHours\": 0\n },\n \"newAllocation\": {\n \"userId\": 1111,\n \"companyId\": 11,\n \"resource\": {\n \"entityId\": 11111,\n \"typeId\": \"Project\"\n },\n \"from\": \"2024-01-01\",\n \"to\": \"2024-03-31\",\n \"assignedByUserId\": 1111,\n \"allocatedHours\": 10\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": "AllocationNotFoundError",
"message": "The specified allocation cannot be found"
}Allocations
Update Allocation
Updates an existing resource allocation. Requires both the old allocation data and the new allocation data.
Known Errors:
InvalidAllocationError— The new allocation is invalid:- Empty
allocatedHoursfield - The
fromdate is greater than or equal to thetodate - The date range exceeds 12 months
- Empty
AllocationNotFoundError— The specified old allocation cannot be foundAllocationAlreadyExistInDatesRangeError— The new allocation already exists within the specified date rangeUserNotFoundError— The specified user in new allocation cannot be foundUserNotHaveWorkDaysError— The user does not have any work days in the new allocation dates rangeProjectNotFoundError— The specified project in new allocation cannot be found
Note: You can use this endpoint to change a project allocation, as long as there isn’t an existing allocation for the same user in the target project for any date within the range of the new allocation.
PUT
/
allocation
/
updateAllocation
Update Allocation
curl --request PUT \
--url https://planner.svc.v2.projectcor.com/allocation/updateAllocation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"oldAllocation": {
"userId": 1111,
"companyId": 11,
"resource": {
"entityId": 11111,
"typeId": "Project"
},
"from": "2024-01-01",
"to": "2024-03-31",
"assignedByUserId": 1111,
"allocatedHours": 0
},
"newAllocation": {
"userId": 1111,
"companyId": 11,
"resource": {
"entityId": 11111,
"typeId": "Project"
},
"from": "2024-01-01",
"to": "2024-03-31",
"assignedByUserId": 1111,
"allocatedHours": 10
}
}
'import requests
url = "https://planner.svc.v2.projectcor.com/allocation/updateAllocation"
payload = {
"oldAllocation": {
"userId": 1111,
"companyId": 11,
"resource": {
"entityId": 11111,
"typeId": "Project"
},
"from": "2024-01-01",
"to": "2024-03-31",
"assignedByUserId": 1111,
"allocatedHours": 0
},
"newAllocation": {
"userId": 1111,
"companyId": 11,
"resource": {
"entityId": 11111,
"typeId": "Project"
},
"from": "2024-01-01",
"to": "2024-03-31",
"assignedByUserId": 1111,
"allocatedHours": 10
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
oldAllocation: {
userId: 1111,
companyId: 11,
resource: {entityId: 11111, typeId: 'Project'},
from: '2024-01-01',
to: '2024-03-31',
assignedByUserId: 1111,
allocatedHours: 0
},
newAllocation: {
userId: 1111,
companyId: 11,
resource: {entityId: 11111, typeId: 'Project'},
from: '2024-01-01',
to: '2024-03-31',
assignedByUserId: 1111,
allocatedHours: 10
}
})
};
fetch('https://planner.svc.v2.projectcor.com/allocation/updateAllocation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://planner.svc.v2.projectcor.com/allocation/updateAllocation';
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
oldAllocation: {
userId: 1111,
companyId: 11,
resource: {entityId: 11111, typeId: 'Project'},
from: '2024-01-01',
to: '2024-03-31',
assignedByUserId: 1111,
allocatedHours: 0
},
newAllocation: {
userId: 1111,
companyId: 11,
resource: {entityId: 11111, typeId: 'Project'},
from: '2024-01-01',
to: '2024-03-31',
assignedByUserId: 1111,
allocatedHours: 10
}
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://planner.svc.v2.projectcor.com/allocation/updateAllocation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'oldAllocation' => [
'userId' => 1111,
'companyId' => 11,
'resource' => [
'entityId' => 11111,
'typeId' => 'Project'
],
'from' => '2024-01-01',
'to' => '2024-03-31',
'assignedByUserId' => 1111,
'allocatedHours' => 0
],
'newAllocation' => [
'userId' => 1111,
'companyId' => 11,
'resource' => [
'entityId' => 11111,
'typeId' => 'Project'
],
'from' => '2024-01-01',
'to' => '2024-03-31',
'assignedByUserId' => 1111,
'allocatedHours' => 10
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://planner.svc.v2.projectcor.com/allocation/updateAllocation"
payload := strings.NewReader("{\n \"oldAllocation\": {\n \"userId\": 1111,\n \"companyId\": 11,\n \"resource\": {\n \"entityId\": 11111,\n \"typeId\": \"Project\"\n },\n \"from\": \"2024-01-01\",\n \"to\": \"2024-03-31\",\n \"assignedByUserId\": 1111,\n \"allocatedHours\": 0\n },\n \"newAllocation\": {\n \"userId\": 1111,\n \"companyId\": 11,\n \"resource\": {\n \"entityId\": 11111,\n \"typeId\": \"Project\"\n },\n \"from\": \"2024-01-01\",\n \"to\": \"2024-03-31\",\n \"assignedByUserId\": 1111,\n \"allocatedHours\": 10\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"error": "AllocationNotFoundError",
"message": "The specified allocation cannot be found"
}Authorizations
Uses the same authentication as the main COR API. Obtain a token from https://api.projectcor.com/v1/oauth/token
Body
application/json
Response
Allocation updated successfully
Was this page helpful?
⌘I

