Tuleap Community Edition development and releases are no longer public. You have until September 30th to download packages and sources in Tuleap project. You can contact the team if you need further assistance.

    •  
      request #10525 REST API method to update the dependencies between 2 SelectBox fields in a tracker
    Infos
    #10525
    Mohamed Hammami (hammamim)
    2017-08-23 12:23
    2017-08-04 11:44
    10774
    Details
    REST API method to update the dependencies between 2 SelectBox fields in a tracker
    As a project administrator I want to update the dependency map between 2 fields ( SelectBox fields) of a tracker using a REST method.

    The REST method should look like this "PUT /trackers/{id}/dependencies"

    This functionality will be done by ST.
    API
    Empty
    Empty
    • [x] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    New
    Empty
    Attachments
    Empty
    References
    References list is empty

    Follow-ups

    User avatar

    The second solution is best since it allows to enhance the route to update something else (eg: tracker description, fields, …) later.

    If you just want to change dependencies in this contribution, then you have to restrict your json to workflow/rules/list:

    {
      "worflow": {
        "rules": {
          "lists": [
            …
          }
        }
      }
    }
    

    That way the user of the API does not think that she can update the whole workflow.

    User avatar
    Yes, if I use the Patch /trackers/{id} route, should I specify in an parameter that I'm only updating the dependencies part of the tracker and then send in the body of the request the array of the rules that I have to update e.g :

    [
    { "source_field_id": 477, "source_value_id": 100, "target_field_id": 478, "target_value_id": 367 },
    { "source_field_id": 477, "source_value_id": 362, "target_field_id": 478, "target_value_id": 366 },
    { "source_field_id": 477, "source_value_id": 363, "target_field_id": 478, "target_value_id": 365 },
    { "source_field_id": 477, "source_value_id": 364, "target_field_id": 478, "target_value_id": 100 }
    ]

    or simply send the rules in their "json hierarchy" in the tracker which is workflow > rules > lists, so the previous rules update example will be sent in the body as a string like this:

    "workflow": {
    "field_id": 243,
    "rules": {
    "dates": [],
    "lists": [
    {
    "source_field_id": 477,
    "source_value_id": 100,
    "target_field_id": 478,
    "target_value_id": 367
    },
    {
    "source_field_id": 477,
    "source_value_id": 362,
    "target_field_id": 478,
    "target_value_id": 366
    },
    {
    "source_field_id": 477,
    "source_value_id": 363,
    "target_field_id": 478,
    "target_value_id": 365
    },
    {
    "source_field_id": 477,
    "source_value_id": 364,
    "target_field_id": 478,
    "target_value_id": 100
    }
    ]
    }
    User avatar
    dependencies are part of /trackers/:id resource, therefore you have to patch /trackers/:id instead of creating a new resource.
    User avatar
    Instead of "PUT /trackers/{id}/dependencies" I will use the "PATCH /trackers/{id}/dependencies" route and since I'm only updating the field dependencies of the tracker I added "/dependencies" subroute.
    User avatar
    Since field dependencies are part of the tracker structure which is returned by GET /trackers/:id, you should use the resource /trackers/:id instead of creating a new one (/trackers/:id/dependencies is not a sub-resource of /trackers/:id).

    Therefore you must define PUT or PATCH /trackers/:id. PUT will require to be able to change the whole structure of a tracker. PATCH allows to change only part of the resource, which seems to correspond to your need.
    User avatar
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes