So this API i'm integrating with wants me to post XML. Yet it's response comes back in JSON!

What the actual fuck?

  • 7
    That's called inclusion. Don't be dataist.
  • 16
    bitch please, you get to complain when you have to send JSON with XML embedded in it and the same with responses.

    for example:
  • 3
    @C0D4 wow that is really weird!
  • 3
    yea, its a pain.

    proxy api grabs the xml, and forwards it to another service, but rather then just parsing the json and building the xml its self, the devs just grab the xml and send it as is, putting the responsibility on the sender.
  • 0
    It's not something I haven't seen. A RESTful API should ideally accept JSON and return JSON, but the latter is typical of such an API. Accepting an XML is of course business-dependent. Sometimes an API accepts both XML and JSON - it just depends on what the client wants.
  • 3
    @C0D4 May god have mercy on your soul. Thats just retarded...
  • 2
    My situations once:

    SOAP API, returns json with encrypted XML data that you can decrypt using a private key THEY provided you with
  • 3
    Have you tried changing the accept header?
  • 1
    @SortOfTested this. Explicitly requesting typed responses may help.
Add Comment