Uploaded image for project: 'ManifoldCF'
  1. ManifoldCF
  2. CONNECTORS-99

REST API serialization inconsistency

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • ManifoldCF 0.1, ManifoldCF 0.2, ManifoldCF 0.3
    • ManifoldCF 0.6
    • API, Documentation
    • None
    • ACF trunk.

    Description

      There is some inconsistency in REST APIs that makes the returned values more difficult to process than necessary. It boils down to the fact that lists of values are serialized into JSON arrays only when there is more than 1 element on the list, but they are serialized into plain JSON objects when there is 0 or 1 element on the list. Example:

      • listings of jobs, connectors, connections, repositories etc. all suffer from this symptom:
      * 1 element:
        {"job":{"id":"1283811504796","description":"job 1" ...
      * 2 elements:
        {"job":[{"id":"1283811504796","description":"job 1" ...
      
      • nested elements, such as e.g. job metadata:
      1 element:
        "metadata":{"_value_":"","_attribute_name":"jobKey1","_attribute_value":"jobVal1"}
      2 elements:
        "metadata":[{"_value_":"","_attribute_name":"jobKey1","_attribute_value":"jobVal1"},{"_value_":"","_attribute_name":"jobKey2","_attribute_value":"jobVal2"}]
      

      In my opinion, in all the above cases the API should always return a JSON array for those elements that can occur with cardinality > 1.

      Attachments

        Activity

          People

            kwright@metacarta.com Karl Wright
            ab Andrzej Bialecki
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: