10
neeno
4y

Why use an Accept header when you can do this, right?

randomapi.com/random/resource/json
randomapi.com/random/resource/xml

🤦‍♂️

I'm already feeling it, I'm gonna have a great time with this API

Comments
  • 2
    It would be nicer if it can accept token as a query param
  • 2
    nothing unusual here, far from the worst design in the world 🤔

    Now, what would be actually bad is if /json returned XML, and /xml returned JSON. But that's not the case here. Or is it...
  • 1
    @asgs I'll hit you with my keyboard and make you choke on the keycaps
  • 1
    @hinst hopefully it isn't, haven't made any requests to it yet...
  • 1
    Sure, not the best design, but if their intention is for users to be able to just generate some dummy data quickly then being able to tell the API which format to use using the URL would allow them to link to the API and let the user open it in their browser.
  • 1
    @ScriptCoded good point, but it's not a dummy data generator, it's a ZIP code search engine, I just omitted the API's actual address.
  • 1
    @neeno Well then, then I'm all with you
  • 7
    Let's create a GitHub repo with the worst API ideas in the world, kinda like
    https://theworldsworstwebsiteever.com/...

    Let's call it UNREST
  • 0
    @eo2875 honestly, I like the idea. However, I'm not gonna create the repo because I like my anonymity here on DevRant. But I do like a lot the idea.
  • 0
    I do that when I know I'll run out of standard content-types. Introducing custom ones just doesn't feel right.

    Another thing with format in URL -- browser-friendly approach. Just pop that URL in your addressbar and there you have it.
  • 0
    What if that api later wants to offer slugs as route param?

    Ima name that slug json (:

    Defining an Accept header is a standard afaik :)
  • 0
    @eo2875 that site needs infinite scroll both horizontally and vertically to be truly the worst
  • 1
    @eo2875 In many ways I prefer that website over many modern sites.

    If it was the worst website, it would:

    Hijack the history so the back button doesn't work

    Have a privacy options dialog with no actual options, which covers the whole screen by default, and won't close until you signed up for the newsletter

    Said dialog would be of a fixed giant size, not centered and anchored to the viewport, so it's unclosable on smaller screens

    Autoplay a loud live video after a few seconds, which has no control elements for playback or volume, and will float on the page when scrolling

    Have a fading paragraph with actually interesting information leading into a paywall

    Place tracker cookies to retarget you on other websites with ads for buying cow sperm

    Disable right click and ctrl-C

    Load a crypto mining JavaScript snippet so your browser becomes unresponsive

    Uses onbeforeunload to display a confirmation dialog when trying to close the page
  • 0
    @bittersweet ... and how is that different from any other website in the internet? 😂
  • 1
    @eo2875 That's what I mean... Compared to the rest of the modern internet, a site like https://theworldsworstwebsiteever.com/... is actually a pleasure to use. Not pretty, but it's predictable, stable and works very well on all devices.

    Take https://brutalist-web.design/ as an example. Not pretty either. But it is clearly readable, has great predictable UX.
Add Comment