Table of contents
Schedules
Download API definition:
This API is a Technical Preview and is available for testing purposes only. Do not use in production.
POST https://dev-api.bentley.com/schedules/{scheduleId}/tasks

Creates a Task for a Schedule.

Tasks are but not limited to portions of work that are used to help determine the overall workload required and timeframe needed to complete the project.

Task Types

Tasks can be of differing types. The following Task types have different behaviors:

  • Work: The default Task type. Work represents an expenditure of effort and resources achieving the Task. Work type Tasks have a Start, Finish and a Duration.
  • StartKeyDate: A Project Milestone - setting a Task as a Key Date will also change its representation in the Gantt Chart to a diamond, and give the Task a zero duration. Start Key Dates have no Finish Date or Duration.
  • FinishKeyDate: A Project Milestone - setting a Task as a Key Date will also change its representation in the Gantt Chart to a diamond, and give the Task a zero duration. Finish Key Dates have no Start Date or Duration.
  • ShortHammock: Spans the shortest duration between all its predecessor and successor Tasks. The Start, Finish, and Duration of the Short Hammock is derived from its predecessor and successor Tasks and cannot be edited directly.
  • LongHammock: Spans the longest duration between all its predecessor and successor Tasks. The Start, Finish, and Duration of the Long Hammock is derived from its predecessor and successor Tasks and cannot be edited directly

The remaining Task Types behave the same as the Work type and can be used to help label Tasks.

Operation

Operations, also known as LROs (Long Running Operations), are time-consuming tasks that would not be completed in the appropriate timeframe for a single request response. Endpoints that use operations return an operation id that can be used on a separate endpoint to track the progress of the task that is being handled.

Authentication

Requires Authorization header with valid Bearer token for scope itwin-platform.

For more documentation on authorization and how to get access token visit OAUTH2 Authorization page.

Rate limits

All iTwin Platform API operations have a rate limit. For more documentation on that visit Rate limits and quotas page.

Request parameters

Name
Required?
Description
scheduleId
Yes

The unique identifier of the Schedule.

Request headers

Name
Required?
Description
Authorization
Yes

OAuth access token with itwin-platform scope

Accept
Yes

Setting to application/vnd.bentley.itwin-platform.v1+json is recommended.

Request body

Task Create Request

Name
Type
Required?
Description
comment
String, null
No

The comment of the Task. The comment cannot exceed 1000 characters.

id
String, null
No

The unique identifier of the Task.

name
String
No

The name of the Task.

parentId
String, null
No

The unique identifier of the parent Task.

plannedDuration
Int32, null
No

The time allotted to complete a Task. It can only change for Tasks with Planned Status. The value is a timestamp of seconds.

plannedStart
Date-time
No

The Start Date of the Task.

type
No

The type of the Task.

url
String, null
No

A URL associated with the Task.

userDefinedId
String, null
No

A unique Task Id defined by the user.

Example

json
{
    "comment": "Comment about demolishing",
    "id": "fc3673d9-e385-4031-abbe-663535a329f5",
    "name": "Demolish Old Building",
    "parentId": "e3e4f597-8b58-4c0a-8931-1f3f55a7b34b",
    "plannedDuration": 144000,
    "plannedStart": "2019-12-02T08:00:00Z",
    "type": "Work",
    "url": "https://example.com",
    "userDefinedId": "D256"
}

Response 202 Accepted

This response indicates that the requested long-running operation was Accepted.

json
{
    "operation": {
        "id": "1604789f-68c4-46ba-b20d-8a19f8319362"
    },
    "task": {
        "id": "fc3673d9-e385-4031-abbe-663535a329f5"
    },
    "_links": {
        "operationLocation": {
            "href": "https://api.bentley.com/schedules/5e11b21e-cba2-48a8-a2c1-2977d2d373e0/operations/1604789f-68c4-46ba-b20d-8a19f8319362"
        }
    }
}

Response headers

Name
Description
Operation-Id

The unique identifier of the Operation.

Operation-Location

URL to the Operations endpoint with pre-entered Operation ID.

Response 400 Bad Request

The 400 (Bad Request) status code indicates that the request cannot be processed by the server due to a client error (e.g. malformed request syntax)

json
{
    "error": {
        "code": "InvalidSchedulesRequest",
        "details": [{
                "code": "MissingRequiredProperty",
                "message": "A required property is missing or empty.",
                "target": "name"
            },
            {
                "code": "MissingRequiredProperty",
                "message": "A required property is missing or empty.",
                "target": "type"
            }
        ],
        "message": "The request contains invalid properties."
    }
}

Response 401 Unauthorized

This response indicates that request lacks valid authentication credentials. Access token might not been provided, issued by the wrong issuer, does not have required scopes or request headers were malformed.

json
{
    "error": {
        "code": "HeaderNotFound",
        "message": "Header Authorization was not found in the request. Access denied."
    }
}

Response 403 Forbidden

User is not authorized to create a Task.

json
{
    "error": {
        "code": "InsufficientPermissions",
        "message": "The user has insufficient permissions for the requested operation."
    }
}

Response 404 Not Found

This response indicates that the provided Schedule is not available.

json
{
    "error": {
        "code": "ScheduleNotFound",
        "message": "Requested Schedule is not available.",
        "target": "scheduleId"
    }
}

Response 409 Conflict

This response indicates that a changeset with provided Id already exists or provided Schedule is not initialized.

json
{
    "error": {
        "code": "ScheduleNotInitialized",
        "message": "Provided Schedule is not initialized. Current Schedule state: 'Processing'."
    }
}

Response 429 Too many requests

This response indicates that the client sent more requests than allowed by this API for the current tier of the client.

json
{
    "error": {
        "code": "RateLimitExceeded",
        "message": "The client sent more requests than allowed by this API for the current tier of the client."
    }
}

Response headers

Name
Description
retry-after

Number of seconds to wait until client is allowed to make more requests.

Link

Hyperlink container.

Name
Type
Description
href
String

Hyperlink to the specific entity.

Operation Create Response Properties

Contains the id of the created long-running operation.

Name
Type
Description
id
String, null

The unique identifier of the Operation.

Operation Location

Contains the URL to the Operations endpoint to check the information about a long-running operation.

Name
Type
Description
operationLocation

URL to the Operations endpoint with pre-entered Operation ID.

Task Create Request

Properties of the Task to be created.

Name
Type
Description
comment
String, null

The comment of the Task. The comment cannot exceed 1000 characters.

id
String, null

The unique identifier of the Task.

name
String

The name of the Task.

parentId
String, null

The unique identifier of the parent Task.

plannedDuration
Int32, null

The time allotted to complete a Task. It can only change for Tasks with Planned Status. The value is a timestamp of seconds.

plannedStart
Date-time

The Start Date of the Task.

type

The type of the Task.

url
String, null

A URL associated with the Task.

userDefinedId
String, null

A unique Task Id defined by the user.

Task Create Response

Contains properties of the created long-running operation, and a link to this operation.

Name
Type
Description
operation

Contains properties of the created long-running operation.

task

Properties of the Task to be created.

_links

Contains the hyperlink to the Operations endpoint to check the operation information.

Task Create Response Properties

Contains properties of the Task that is queued for creation.

Name
Type
Description
id
String

The unique identifier of the Task.

Task Type

Task Type provides a categorization (or classification) of project Tasks. See the Task Types section for details.

Name
Type
Description
Work
String
StartKeyDate
String
FinishKeyDate
String
ShortHammock
String
LongHammock
String
Rfi
String
ChangeOrder
String
Testing
String
Delivery
String
Meeting
String
Rework
String
Design
String
Maintenance
String
Manufacture
String
Storage
String
Purchase
String
Receive
String
Delay
String
WeatherDelay
String
Unknown
String

DetailedError

Contains error information and an array of more specific errors.

Name
Type
Description
code
String

One of a server-defined set of error codes.

message
String

A human-readable representation of the error.

target
String, null

The target of the error.

details

Optional array of more specific errors.

Detailed Error Response

Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.

Name
Type
Description
error

Error Detailed information.

Error

Contains error information.

Name
Type
Description
code
String

One of a server-defined set of error codes.

message
String

A human-readable representation of the error.

target
String, null

The target of the error.

Error Response

Gives details for an error that occurred while handling the request. Note that clients MUST NOT assume that every failed request will produce an object of this schema, or that all of the properties in the response will be non-null, as the error may have prevented this response from being constructed.

Name
Type
Description
error

Error information.

Was this page helpful?