Incompetent contractors' idea of an API



  • So in one of our projects, we are forced to cooperate with an ERP subcontractor who sold our client the software we are supposed to interface with. Queue all the joys of working with someone who knows they got you by the balls and there's nothing you can do about it - not responding to mails, only doing something after 15 CC-s to the client, trying to plug themselves into the project, etc.

    But fine, whatever. Today, after months of jerking us around, they finally send us a link to the simple two-method read-only API to their crapfest ERP.

    http://client.company.com:8080/api/Client/GetItems
    http://client.company.com:8080/api/Client/GetCategories

    OK, a REST API designed by people who don't know anything about API-s. I test the first method, and... it sort of works.

    [
    	{
    		"ArticleId": "173114",
    		"ArticleDesc": "Kitchen table 2.15 x 1.15 x 0.80, black",
    		"Weight": "...",
    		"Price": "...",
    		...
    	}, {
    		"ArticleId": "173115",
    		"ArticleDesc": "Kitchen table 2.15 x 1.15 x 0.80, white"
    		...
    	},
    	(... 10000 more items here ...)
    ]
    

    It just dumps all the data from their DB, with field names copied from DB (and in a foreign language too - anonymized above). Except...

    "WTF? There is no category ID-s in these items.... And GetCategories method doesn't even work."

    But fine, everyone makes mistakes. I shoot them an email, and this morning, lo and behold, a prompt response, saying they actually fixed it! I check the first method and they actually added SectionCode and CategoryCode to the items!

    Is it possible? Did they actually do something right? Have I unfairly misjudged them?

    Output from the "fixed" GetCategories method:

    [
    	{
    		"SectionCode": 100,
    		"CategoryCode": "101",
    		"SectionDesc": "Home furniture",
    		"CategoryDesc": "Kitchen",
    		"ArticleDesc": "Kitchen table 2.15 x 1.15 x 0.80, black"
    	}, {
    		"SectionCode": 100,
    		"CategoryCode": "101",
    		"SectionDesc": "Home furniture",
    		"CategoryDesc": "Kitchen",
    		"ArticleDesc": "Kitchen table 2.15 x 1.15 x 0.80, white"
    	},
    	(... 10000 more items here ...)
    ]
    

    Okaay....

    I start writing the guy an email, explaining... what exactly should I explain? How not to suck? And then I remember the months it took us to get to this point.

    Yes, thank you, sir mr. contractor. Bravo for your stellar effort. Just don't touch anything else and let me fix this shit on my end.


  • I survived the hour long Uno hand

    I had a conference call with some external QA contractors that ended ten minutes ago.

    They're getting a branch in our repo to make changes.

    God help us all.


  • Fake News

    @Yamikuronue said:

    QA contractors

    @Yamikuronue said:

    make changes

    Waaaaaat?


  • I survived the hour long Uno hand

    Test automation repository.


  • BINNED

    @cartman82 said:

    and in a foreign language too

    Oh dear. Let me guess, they are using diacritics as well. Unicode support blowing up in 3... 2...

    Also, that data structure reminds me of an XML monstrosity I had to deal with once. All I will say is: it seems that at least you have some kind of consistent IDs. I hope. If not... I'm sorry. I'm so, so sorry...


    Filed under: Also, the elevator bar broke again, Did we define that?


  • FoxDev

    @Yamikuronue said:

    I had a conference call with some external QA contractors that ended ten minutes ago.

    They're getting a branch in our repo to make changes.


    So long as their branch is correctly isolated, and they cannot merge into main/trunk/whatever you call the root branch (but you can, of course).

    Otherwise,



  • @Onyx said:

    Oh dear. Let me guess, they are using diacritics as well. Unicode support blowing up in 3... 2...

    Also, that data structure reminds me of an XML monstrosity I had to deal with once. All I will say is: it seems that at least you have some kind of consistent IDs. I hope. If not... I'm sorry. I'm so, so sorry...

    So far, all field names are ASCII, although their data isn't. But they are on the MS stack, so they are probably top-to-bottom unicode.

    @Onyx said:

    Also, that data structure reminds me of an XML monstrosity I had to deal with once. All I will say is: it seems that at least you have some kind of consistent IDs. I hope. If not... I'm sorry. I'm so, so sorry...

    Yeah, luckily we just need the data dump, with only categories for joins. But as we move forward with the project, who knows what horrors lie ahead.

    BTW, why the fuck do they need foreign keys for both the section and category? Fuck, they suck.


  • BINNED

    @cartman82 said:

    BTW, why the fuck do they need foreign keys for both the section and category? Fuck, they suck.

    I'll take that over no keys whatsoever. That XML thing? It was a catalogue and I had to "join" data from 2 separate files. Let's just say one of the fallback join methods was using the URL of the product image.

    Also, I know of a certain forum software which has no foreign keys anywhere in it's database...


  • FoxDev

    @Yamikuronue said:

    God help us all.

    May the Goddess have mercy on their souls



  • @Onyx said:

    foreign keys

    FK are bad for your ORM.


  • Discourse touched me in a no-no place

    @Onyx said:

    one of the fallback join methods was using the URL of the product image

    Have yourself a join key: :facepalm:



  • @accalia said:

    @Yamikuronue said:
    God help us all.

    May the Goddess have mercy on their souls

    Wrong target for that sentiment.


  • I survived the hour long Uno hand

    Accalia's probably envisioning what I'll do to them when they fail me ;)


  • FoxDev

    This. Exactly this.

    😝



  • Bonus WTF: Some of these records have "PictureURL". Trying to load one of these, I get:

    {"ClassName":"System.IO.DirectoryNotFoundException","Message":"Could not find a part of the path 'c:\\windows\\system32\\inetsrv\\{DapperRow, PDMFileName = '\\SBS\\TS$\\Redirect\\location\\Desktop\\Client 2014\\Idiot Developer's Name\\name_of_the_product_15.png', Extension = '.png'}'.".... and so on
    


  • System paths are quite hard and when you add HTTP paths into the mix, wooohooo!


  • Discourse touched me in a no-no place

    So that's a DeveloperIsAnIdiotException rendered as JSON?


Log in to reply