JSON Report_ChartOfAccounts superfluous object

Hi, I am playing with The Chart Of Accounts endpoint.

The data structure uses a superfluous “Nominal” Object in JSON, making the API inconsistent across the endpoints.

For illustration, here are three different response bodies for

  1. no nominals found (i.e. empty list returned from search query)
  2. one nominal found
  3. 2 or more nominals found.

No nominals found

"Body": {
  "Nominals": null
}

One nominal found

"Body": {
  "Nominals": {
    "Nominal": {
      "Code": "1251",
      "SystemCode": "False",
      "Amount": "****"
    }
  }
}

2 or more nominals found

"Body": {
  "Nominals": {
    "Nominal": [
      {
        "Code": "1201",
        "SystemCode": "True",
        "Amount": "****"
      },
      {
        "Code": "1210",
        "SystemCode": "False",
        "Amount": "****"
      }
    ]
  }
}

These SHOULD BE like this, for consistency:

No nominals found

"Body": {
  "Nominals": null
}

One nominal found

"Body": {
  "Nominals": {
      "Code": "1251",
      "SystemCode": "False",
      "Amount": "****"
  }
}

2 or more nominals found

"Body": {
  "Nominals": [
    {
      "Code": "1201",
      "SystemCode": "True",
      "Amount": "****"
    },
    {
      "Code": "1210",
      "SystemCode": "False",
      "Amount": "****"
    }
  ]
}

Hi @Michel

Thank you for your feedback.

I’m not sure that we’re going to be able to change anything here at this stage due to other applications already dependant on the existing format.

I’ll certainly pass your feedback to our development team however and will let you know if anything changes.

You have to remember that the QuickFile API isn’t really a JSON-native design, it’s simply a JSON/XML mapper layered on top of their existing XML-based API. The three cases are the JSON mappings of a <Nominals> XML element with respectively zero, one or more than one <Nominal> child.

If you want consistency then you’d be better off using the XML API directly.

I tried the XML API, but the responses I get are nowhere near being digestible by a JAXB-generated binding based on the XSDs that are available to me.

I constantly get XML schema violation errors for the responses. Where’s the beef in using XML Schema requiring your requests to be schema qualified but the responses aren’t?

This is the reason why I thought to try out the JSON schema as this is schema-less - but as it turns out also inconsistent. :frowning:

UPDATE:

Hi @QFMathew ,

Short after I wrote this post, the JSON endpoint seem to have changed its behaviour!

This:

now turns out to be that:

No nominals found

"Body": null