Overview
In this article, you’ll find tutorials on exporting, importing, and managing Gantt tasks via the PlanRadar API, including importing schedules with phases and tasks, and updating individual Gantt phases or tasks.
Find other tutorials in Open API Overview > API Tutorials.
Export Gantt Charts
You can export the Gantt chart as an XML file.
Endpoint
GET /api/v2/{customer_id}/projects/{project_id}/gantt_tasks/export
Example request (cURL):
curl "https://www.planradar.com/api/v2/{CUSTOMER_ID}/projects/{PROJECT_ID}/gantt_tasks/export" \
-H "accept: application/json" \
-H "X-PlanRadar-API-Key: YOUR_API_KEY"Response
- Returns the Gantt chart data in XML format
Import Gantt Charts
Importing a Gantt chart consists of two steps:
1. Set the Schedule Start Date
Before importing, define the start date of the schedule.
Endpoint
PUT /api/v1/{customer_id}/projects/{project_id}
Example request (cURL):
curl -X PUT 'https://www.planradar.com/api/v1/{CUSTOMER_ID}/projects/{PROJECT_ID}' \
-H 'accept: application/vnd.api+json' \
-H 'content-type: application/vnd.api+json' \
-H 'X-PlanRadar-API-Key: YOUR_API_KEY' \
--data '{
"data": {
"attributes": {
"scheduleStartDate": "YYYY-MM-DD",
"update_manual_tasks": false,
"update_only_schedule_start_date": true
}
},
"filter": {},
"included": {}
}'2. Import the Gantt XML File
Upload your XML file to import phases and tasks into the project.
Endpoint
POST /api/v2/{customer_id}/projects/{project_id}/gantt_tasks/import
Example request (cURL):
curl -X POST 'https://www.planradar.com/api/v2/{CUSTOMER_ID}/projects/{PROJECT_ID}/gantt_tasks/import' \
-H 'accept: application/vnd.api+json' \
-H 'X-PlanRadar-API-Key: YOUR_API_KEY' \
-F 'data[attributes][file]=@/path/to/file.xml;type=text/xml'Use @/path/to/file.xml to reference a local file.
Response
- Status code: 204 No Content
- The import is processed in the background
Update Gantt Phase or Task
You can update an existing Gantt phase or task using its ID.
Endpoint
PUT /api/v2/{customer_id}/projects/{project_id}/gantt_tasks/{id}
The {id} is the ID of the phase or task you want to update.
Example request body
{
"data": {
"attributes": {
"title": "string",
"start_date": "string",
"end_date": "string",
"parent_id": "string", // Phase id to set the phase as a sub phase
"duration": 0,
"auto": true,
"task_order": 0, // Order of the task/phase in the same level of the tree
"progress": 0,
"has_custom_progress": true
}
}
}
Response
Returns the updated phase/task object:
{
"data": {
"id": "ogbgyxx",
"type": "gantt-tasks",
"attributes": {
"id": "ogbgyxx",
"title": "new Title",
"start-date": "2024-12-05",
"end-date": "2024-12-18",
"uuid": "6bc87c73-4e85-4f56-a20b-62575e1a46e2",
"path": "1",
"task-order": 1,
"taskable-id": null,
"taskable-type": null,
"status": "active",
"progress": 0,
"has-custom-progress": false,
"auto": true,
"duration": 10,
"expected-start-date": null,
"expected-end-date": null,
"parent-id": null,
"customer-id": "kkdzpd",
"project-id": "pyxpew",
"user-id": "lmqjnkn",
"depth": 1,
"has-conflict": false
},
"relationships": {
"taskable": {
"data": null
},
"successors": {
"data": []
},
"predecessors": {
"data": []
}
}
}
}
Comments
0 comments
Please sign in to leave a comment.