Get initial task states

Prev Next

This tutorial demonstrates how to get the initial states of the task types via RESTful API.

The steps include:

  • Get the task type_id from the list of task types

  • Getting the initial states of task types

The commands are provided in curl and can be run from the command prompt when the Synergy Server is running (or in a batch script).

Additional API documentation

To get a list of most of the API requests available, with the 12d Synergy server running, browse http://synergy.myserver.com/api-docs/ui/index.

(Replace synergy.myserver.com with the external server address and update the port numbers if necessary.)

1.1. Getting the Personal Access Token to access API

The tutorial for getting the PAT is here: Generate PAT in Web Client.

1.2. Get the task type ID from the list of task types

To get the task type ID, you can follow the steps here: Get Task Types

1.3. Get the initial task states

This request can be found in the API Documentation under Tasks marked 'Get initial task states'.

Once you have the value for task_type_id, it should be included as query parameters.

Sample Request

curl --location 'http://localhost:8080/api/v1/tasks/getInitialTaskStates?task_type_id={task-type-id-here}' \

--header 'Authorization: Bearer <your-token-here>' \

--header 'Content-Type: application/json' \

Below is a sample response when getting the initial task states. Click in the line below to see the code.

Sample Response

[

    {

        "is_closure": 0,

        "id": {

            "_id": 1,

            "_server_id": 1,

            "_server_guid": "b993c729-bf98-490c-989d-5621e3b48139",

            "IDString": "1_1"

        },

        "name": "Not Started",

        "sort_order": 1,

        "attributes": [],

        "completion_percentage": null

    },

    {

        "is_closure": 0,

        "id": {

            "_id": 2,

            "_server_id": 1,

            "_server_guid": "b993c729-bf98-490c-989d-5621e3b48139",

            "IDString": "2_1"

        },

        "name": "In Progress",

        "sort_order": 2,

        "attributes": [],

        "completion_percentage": null

    },

    {

        "is_closure": 1,

        "id": {

            "_id": 3,

            "_server_id": 1,

            "_server_guid": "b993c729-bf98-490c-989d-5621e3b48139",

            "IDString": "3_1"

        },

        "name": "Closed",

        "sort_order": 3,

        "attributes": [],

        "completion_percentage": null

    }

]