•  
      request #6343 "fields" should be a JSON Array in GET /trackers/:id and GET /projects/:id/trackers
    Infos
    #6343
    Laurent Delaigue (ldelaigue)
    2014-03-07 18:48
    2014-02-28 11:02
    6420
    Details
    "fields" should be a JSON Array in GET /trackers/:id and GET /projects/:id/trackers
    According to the doc, "fields" is supposed to be an array, and most of the times it is, but sometimes it's not.Sometimes it's an object like this:

    "fields":{
    "0":{"field_id":585,"label":"Artifact ID","name":"artifact_id","type":"aid","values":null,"bindings":{"type":null,"list":[]},"permissions":["read"]},
    "1":{"field_id":587,"label":"Last Modified On","name":"last_update_date","type":"lud","values":null,"bindings":{"type":null,"list":[]},"permissions":["read"]},
    ...

    instead of simply:
    "field":[
    {"field_id":585,"label":"Artifact ID","name":"artifact_id","type":"aid","values":null,"bindings":{"type":null,"list":[]},"permissions":["read"]},
    {"field_id":587,"label":"Last Modified On","name":"last_update_date","type":"lud","values":null,"bindings":{"type":null,"list":[]},"permissions":["read"]},
    ...

    This concerns GET /trackers/:id and GET /projects/:id/trackers
    API
    6.10
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Manuel Vacelet (vaceletm)
    Closed
    Empty
    Attachments
    References
    Referencing request #6343

    Artifact Tracker v5

    rel #6234 6.12

    Git commit

    tuleap/tuleap/dev

    Merge commit 'refs/changes/49/2049/2' of ssh://gerrit.tuleap.net:29418/tuleap into tuleap-stable-master 80bd4f55f2
    request #6343 - "fields" should be a JSON Array in GET /trackers/:id and GET /projects/:id/trackers 174a395da3

    tuleap/tuleap/stable

    Merge commit 'refs/changes/49/2049/2' of ssh://gerrit.tuleap.net:29418/tuleap into tuleap-stable-master 80bd4f55f2
    request #6343 - "fields" should be a JSON Array in GET /trackers/:id and GET /projects/:id/trackers 174a395da3
    request #6343 - "fields" should be a JSON Array in GET /trackers/:id and GET /projects/:id/trackers 2be2c107a5

    tuleap/u/hkelf/tuleap/stable

    Merge commit 'refs/changes/49/2049/2' of ssh://gerrit.tuleap.net:29418/tuleap into tuleap-stable-master 80bd4f55f2
    request #6343 - "fields" should be a JSON Array in GET /trackers/:id and GET /projects/:id/trackers 174a395da3

    tuleap/u/vaceletm/tuleap/dev

    Merge commit 'refs/changes/49/2049/2' of ssh://gerrit.tuleap.net:29418/tuleap into tuleap-stable-master 80bd4f55f2
    request #6343 - "fields" should be a JSON Array in GET /trackers/:id and GET /projects/:id/trackers 174a395da3
    request #6343 - "fields" should be a JSON Array in GET /trackers/:id and GET /projects/:id/trackers 2be2c107a5
    Referenced by request #6343

    Follow-ups

    User avatar

    The problems arise when a field is not readable by a user

    To make a long story short:

    • When you can read all fields, you will have an array of fields: [0 => ..., 1 => ..., 2 =>...]
    • If the second field is not readable, you ends with: [0 => ..., , 2 =>...]
    • This is no longer an array so it's serialized as a map :)
    User avatar
    In your set-up (public project with a non admin and a non project member user), the json returned is well-formed on my side.

    To export a tracker structure, go to the tracker -> admin -> export. You will have an XML file. Please add it in this artifact.
    User avatar
    Hi Yannis,

    Actually I looked into it a bit to provide you an example, and it looks like it only happens on public projects I'm not a member of.

    When I connect as admin, who is a member of this test public project, the JSON structure is all right, but when I connect as another user who is not a member of this test public project, the JSON structure has the problem.

    Is that enough for you? I don't think that providing you with a sample tracker structure would help, but if you still cannot reproduce, I'll provide you my example (In which case, please tell me exactly how to export!).
    User avatar
    Hello,

    I'm not able ti reproduce this issue. On my side, I've always 'fields' : [ { ... } ].
    Can you provide us the structure of a tracker which exports its fields in REST like '0' : {} '1' : {} ?