Skip to main content
POST
/
tasks
/
{task_id}
/
collaborators
Assign collaborators to a task
curl --request POST \
  --url https://api.projectcor.com/v1/tasks/{task_id}/collaborators \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "collaborators": [
    123
  ],
  "reasignEstimate": false
}
'
import requests

url = "https://api.projectcor.com/v1/tasks/{task_id}/collaborators"

payload = {
"collaborators": [123],
"reasignEstimate": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({collaborators: [123], reasignEstimate: false})
};

fetch('https://api.projectcor.com/v1/tasks/{task_id}/collaborators', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
const url = 'https://api.projectcor.com/v1/tasks/{task_id}/collaborators';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({collaborators: [123], reasignEstimate: false})
};

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://api.projectcor.com/v1/tasks/{task_id}/collaborators",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'collaborators' => [
123
],
'reasignEstimate' => false
]),
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://api.projectcor.com/v1/tasks/{task_id}/collaborators"

payload := strings.NewReader("{\n \"collaborators\": [\n 123\n ],\n \"reasignEstimate\": false\n}")

req, _ := http.NewRequest("POST", 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))

}
[
  {
    "id": 123,
    "first_name": "<string>",
    "last_name": "<string>",
    "email": "jsmith@example.com",
    "picture": "<string>",
    "user_position_id": 123,
    "role_id": 123,
    "userPosition": {
      "id": 123,
      "name": "<string>"
    },
    "pivot": {
      "user_id": 123,
      "task_log_id": 123,
      "created_at": "<string>",
      "estimated_by_user": 123
    }
  }
]
[
{
"message": "exists validation failed on task_id"
}
]

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

task_id
integer
required

The ID of the task

Body

application/json
collaborators
integer[]
required

Array of user IDs that should be assigned to the task. Pass an empty array [] to remove all collaborators.

reasignEstimate
boolean
default:false

If true, redistributes the estimated hours evenly among the new collaborators.

Response

Returns the updated array of collaborators

id
integer
first_name
string
last_name
string
email
string<email>
picture
string
user_position_id
integer | null
role_id
integer
userPosition
object | null
pivot
object