The Worst API ever

Michael Roufa - 10 October 2013

I’m integrating with what may be the worst API ever. Check this out!

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="" 
  <Create xmlns="">
    ["{\"type\":\"REDACTED\",\"data\":\"{ParentType: 'REDACTED', ParentId: '1', ActionEntityType: '2', ActionEntityId: '3', SegmentId: '0' }\",\"normalize\":false}"]

So much wrong in so little space. Here we have:

  • a SOAP message…
  • … with a “data” parameter…
  • … containing a JSON array…
  • … of a single string
  • … of JSON (string-escaped, of course)…
  • … that itself contains “data” parameter…
  • … which is again a string….
  • … of improperly formatted JSON!

I suspect the last improper formatting is to reduce the amount of quote-escaping needed given that you are now in double-escape territory. Oh, and lest you think it’s just being permissive — if you attempt to properly JSON-encode the inner data parameter, the call fails with “unable to parse JSON!”

This. Is. A. Maz. Ing.