Clueless, awful XML API



  • This API I have to use for an application at work is just plain awful in a hundred different ways. Here's an example of its fantastic use of XML from the docs:

    EXAMPLE

    type: demographic
    activity: enable
    Input:
    <DATASET>
    <SITE_ID>123</SITE_ID>
    <MLID>345</MLID>
    <DATA type=“id”>2</DATA>
    <DATA type=“id”>3</DATA>
    </DATASET>
    Response:
    <DATASET>
    <TYPE>success</TYPE>
    <DATA>2,3,1425,3300</DATA>
    </DATASET>


    XML data needlessly wrapping a string that contains comma-delimitted values. Brillant!



  • I love the consistency too. It's consistently bad.<r

    What format for date/time? Well, like this:

    <DATA type="date">2002-01-14</DATA>
    <DATA type="timestamp">1024253</DATA> (that's seconds since midnight on the specified "date", naturally)

    except, sometimes like this:

    <DATA type=“extra” id=“DATE”>20071116</DATA>

    And other times like this:

    <DATA type=“extra” id=“DATE”>July 1, 2005</DATA>

    Or like this:

    <DATA type="year">2002</DATA>
    <DATA type="month">12</DATA>
    <DATA type="day">25</DATA>
    <DATA type="hour">8</DATA>

    And sometimes it's a unix timestamp.



  • I see the next version already coming:

    <DATA type="xml">&lt;foo&gt;bar&lt;/foo&gt;</DATA>



  • @eli_d said:

    <DATA type="date">2002-01-14</DATA>

    <DATA type="timestamp">1024253</DATA> (that's seconds since midnight on the specified "date", naturally)

     

    not even normalization like transforming this to

    <DATA type="date">2002-01-25</DATA>

    <DATA type="timestamp">73853</DATA>

      ?  shrug



  • @Quicksilver said:

    @eli_d said:

    <DATA type="date">2002-01-14</DATA>

    <DATA type="timestamp">1024253</DATA> (that's seconds since midnight on the specified "date", naturally)

     

    not even normalization like transforming this to

    <DATA type="date">2002-01-25</DATA>

    <DATA type="timestamp">73853</DATA>

      ?  shrug

    There is nothing normal about this API. 



  • Yep, i've seen stuff like this a lot, it's usually when the API has been written by people who don't quite get what xml is for.  Especially the whole csv data inside an xml node, way too common for my liking, it's funny too because you wonder what the guy was thinking when he wrote it

    "Gee i wish there were someway i could store this list of values in xml....hmmmmmm...i know csv!!!"



  • @element[0] said:

    Yep, i've seen stuff like this a lot, it's usually when the API has been written by people who don't quite get what xml is for.  Especially the whole csv data inside an xml node, way too common for my liking, it's funny too because you wonder what the guy was thinking when he wrote it

    "Gee i wish there were someway i could store this list of values in xml....hmmmmmm...i know csv!!!"

    I mean, I could overlook the fact that pracitcally every value is in a <DATA> node. 
    And I could even overlook the fact that the descriptor for what that node actually contains is, for no good reason, specified in either the "id" or "type" attribute. 
    But why oh why couldn't they have at least made the format of the data in the node consistent?


    Also, did I mention that the backend of the API is (apparently) PHP with minimal error checking? If you send it bad data it usually responds with a blank document.



  • I think any XML format with an element "DATA" in it has high chances of being royally screwed up already...


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.