Settings > API
<?php
declare(strict_types = 1);
use Unirest\Request as Request;
require_once __DIR__ . '/Helper.php';
require_once __DIR__ . '/GoodDay.php';
$Helper = new Helper();
$GoodDay = new GoodDay('YOUR_API_TOKEN');
// ...
Retrieve a list of company projects:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
archived | no | false |
bool |
if set to true returns archived/closed projects |
rootOnly | no | false |
bool |
if set to true returns only root projects |
Get project details by projectId
:
Params | Required | Type / Format | Description |
---|---|---|---|
projectId | yes | string |
projectId |
Create new folder:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
createdByUserId | yes | string |
ID of a user, a new record is created on behalf of | |
name | yes | string |
Folder name | |
parentProjectId | no | null |
string |
Pass parent project ID to create a sub-folder |
color | no | null |
int |
Folder color (1..24) |
Create new project:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
createdByUserId | yes | string |
ID of a user, a new record is created on behalf of | |
projectTemplateId | yes | string |
Project template (type) ID you can find in Organization settings → Project templates | |
name | yes | string |
Project name | |
parentProjectId | no | null |
string |
Pass parent project ID to create a sub-project |
color | no | null |
int |
Folder color (1..24) |
projectOwnerUserId | no | null |
string |
Project owner user ID |
startDate | no | null |
string / Y-m-d |
endDate required - Project start date |
endDate | no | null |
string / Y-m-d |
startDate required - Project end date |
deadline | no | null |
string / Y-m-d |
Project deadline |
Retrieve a list of project users by projectId
:
Params | Required | Type / Format | Description |
---|---|---|---|
projectId | yes | string |
projectId |
Retrieve a list of project tasks by projectId
:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
projectId | yes | string |
projectId | |
projectTemplateId | no | false |
bool |
if set to true returns all open and closed tasks |
name | no | false |
bool |
if set to true returns tasks from project its subfolders |
Retrieve a list of action required tasks by userId
:
Params | Required | Type / Format | Description |
---|---|---|---|
userId | yes | string |
userId |
Retrieve a list of tasks assigned to user by userId
:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
userId | yes | string |
userId | |
closed | no | false |
bool |
if set to true returns all open and closed tasks |
Retrieve task details by taskId
:
Params | Required | Type / Format | Description |
---|---|---|---|
taskId | yes | string |
taskId |
Create new task:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
projectId | yes | string |
Task project ID | |
title | yes | string |
Task title | |
fromUserId | yes | string |
Task created by user ID | |
parentTaskId | no | null |
string |
Pass parent task ID to create a subtask |
message | no | null |
string |
Task description / initial message |
toUserId | no | null |
string |
Assigned To/Action required user ID |
taskTypeId | no | null |
string |
Task type ID |
startDate | no | null |
string / Y-m-d |
endDate required - Task start date |
endDate | no | null |
string / Y-m-d |
startDate required - Task end date |
deadline | no | null |
string / Y-m-d |
Task deadline (due date) |
estimate | no | null |
int |
Task estimate in minutes |
priority | no | null |
int |
Task priority (1-10), 50 - Blocker, 100 - Emergency |
Retrieve a list of task messages by taskId
:
Params | Required | Type / Format | Description |
---|---|---|---|
taskId | yes | string |
taskId |
Create task comment by taskId
:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
taskId | yes | string |
taskId | |
userId | yes | string |
User on behalf of whom API will execute update | |
comment | no | null |
string |
Comment |
Reply or change AR user by taskId
:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
taskId | yes | string |
taskId | |
userId | yes | string |
User on behalf of whom API will execute update | |
actionRequiredUserId | yes | string |
Action required user | |
comment | no | null |
string |
Comment |
Update task status by taskId
:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
taskId | yes | string |
taskId | |
userId | yes | string |
User on behalf of whom API will execute update | |
statusId | yes | string |
New status ID | |
comment | no | null |
string |
Comment |
Update task status by taskId
:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
taskId | yes | string |
taskId | |
userId | yes | string |
User on behalf of whom API will execute update | |
startDate | no | null |
string / Y-m-d |
Task start date, 'reset' to reset |
endDate | no | null |
string / Y-m-d |
Task end date, 'reset' to reset |
deadline | no | null |
string / Y-m-d |
Task deadline (due date), 'reset' to reset |
priority | no | null |
int |
Task priority (1-10), 50 - Blocker, 100 - Emergency |
estimate | no | null |
string / Y-m-d |
Task estimate in minutes, 'reset' to reset |
progress | no | null |
string / Y-m-d |
Task progress percentage (0-100) or 'reset' to reset |
title | no | null |
string |
Task title |
Delete task by taskId
:
By deleting a task you also delete all task's related data including time reports, subtasks, etc.
It is recommended to cancel tasks (by updating status) instead of deleting.
Params | Required | Type / Format | Description |
---|---|---|---|
taskId | yes | string |
taskId |
Retrieve list of events:
Event types: https://www.goodday.work/developers/api-v2/events
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
startDate | yes | string / Y-m-d |
Events start date | |
endDate | yes | string / Y-m-d |
Events end date | |
eventTypes | no | null |
string / 'eventType1,eventType2' |
List of event types separated by comma, no spaces |
Retrieve event details by eventId
:
Params | Required | Type / Format | Description |
---|---|---|---|
eventId | yes | string |
eventId |
Create new event:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
createdByUserId | yes | string |
ID of a user, a new event is created on behalf of | |
eventType | yes | string |
Event type | |
name | yes | string / Y-m-d |
Event name | |
startDate | yes | string / Y-m-d |
Event start date | |
endDate | depends on event types | null |
string / Y-m-d |
Event end date. Not required for single-day events i.e. project-milestone |
userId | required for personal events | null |
string |
Personal event user ID |
projectId | required for project events | null |
string |
Project/folder ID |
notes | no | null |
string |
Event notes |
assignedToUserId | no | null |
string |
User ID an event is assigned to |
Delete an Event by eventId
:
Params | Required | Type / Format | Description |
---|---|---|---|
eventId | yes | string |
eventId |
Retrieve a list of users:
Retrieve user details by userId
:
Params | Required | Type / Format | Description |
---|---|---|---|
userId | yes | string |
userId |
Create time report by taskId
:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
taskId | yes | string |
taskId | |
userId | yes | string |
User on behalf of whom API will execute update | |
reportedMinutes | yes | int |
Reported time in minutes | |
date | no | null |
string / Y-m-d |
Date you want to report time for, current date will be set if not passed |
comment | no | null |
string |
Comment |
List of time reports for a specific user by userId
:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
userId | yes | string |
userId | |
startDate | no | string / Y-m-d |
endDate required - Start date filter | |
endDate | no | string / Y-m-d |
startDate required - End date filter |
List of time reports for a specific task by taskId
:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
taskId | yes | string |
taskId | |
subtasks | yes | bool |
if set to true returns time reports for all subtasks | |
startDate | no | null |
string / Y-m-d |
endDate required - Start date filter |
endDate | no | null |
string / Y-m-d |
startDate required - End date filter |
List of time reports for a specific project by projectId
:
Params | Required | Default | Type / Format | Description |
---|---|---|---|---|
projectId | yes | string |
projectId | |
subtasks | yes | bool |
if set to true returns time reports for all subprojects | |
startDate | no | null |
string / Y-m-d |
endDate required - Start date filter |
endDate | no | null |
string / Y-m-d |
startDate required - End date filter |
List of all time reports for a specified period of time:
Params | Required | Type / Format | Description |
---|---|---|---|
startDate | yes | string / Y-m-d |
endDate required - Start date filter |
endDate | yes | string / Y-m-d |
startDate required - End date filter |
projectIds | yes | array |
Projects filter |
userIds | yes | array |
Users filter |
Retrieve a list of all custom fields.
Update task's custom fields values by taskId
:
Custom Field Types: https://www.goodday.work/developers/api-v2/custom-fields
Params | Required | Type / Format | Description |
---|---|---|---|
taskId | yes | string |
taskId |
customFields | yes | string / json |
Array of objects |
Retrieve a list of all statuses within the organization.
Retrieve a list of available task types.
// use Unirest\Request as Request;
$Helper = new Helper();
$GoodDay = new GoodDay('YOUR_API_TOKEN');
$Helper::d("My GoodDay Projects");
$projects = $GoodDay->getProjects();
$Helper::d($projects, $Helper::toObject( Request::getInfo()));
$Helper::dd("Dump&Die");
Convert array to object
Mostly used with Request::getInfo()
:
// use Unirest\Request as Request;
$Helper = new Helper();
$GoodDay = new GoodDay('YOUR_API_TOKEN');
$projects = $GoodDay->getProjects();
$Helper::d($projects, $Helper::toObject( Request::getInfo() ));
Calculate the sum of the ArrayColumn
Mostly used with timeReported
:
$Helper = new Helper();
$GoodDay = new GoodDay('YOUR_API_TOKEN');
$taskTimeReport = $GoodDay->getTaskTimeReport('TASK_ID');
$totalTaskTimeReported = (int) $Helper::sumArrayColumn($taskTimeReport->body, 'timeReported');
$Helper::d($totalTaskTimeReported);
Get current date in GoodDay format
Usage: $Helper::currentDate()
:
$Helper = new Helper();
$GoodDay = new GoodDay('YOUR_API_TOKEN');
$currentDate = $Helper::currentDate();
$currentEvents = $GoodDay->getEvents($currentDate, $currentDate);
$Helper::d($currentEvents);
Get date in GoodDay format
Usage: $Helper::getDate('+3 days')
:
$Helper = new Helper();
$GoodDay = new GoodDay('YOUR_API_TOKEN');
$currentEvents = $GoodDay->getEvents($Helper::getDate('-3 days'), $Helper::getDate('+3 days'));
$Helper::d($currentEvents);
Dump
Usage: $Helper::d("My GoodDay API Project");
Shortcut for:
print("<pre>");
foreach (func_get_args() as $arg) {
print_r($arg);
}
print("</pre>");
Dump&Die
Usage: $Helper::dd("Dump&Die");
Shortcut for:
print("<pre>");
foreach (func_get_args() as $arg) {
print_r($arg);
}
print("</pre>");
exit();
Made with ❤️ by George Martinec