I submitted a question asking the difference between two content types used in HTTP requests and the when/why to use one over the other. My question was closed as off-topic, as it is allegedly "not about programming or software development."
That's because the person who makes this choice is administrating a server, not writing code. When you write code that makes an HTTP request, you follow the choice that was made by the server.
You say in the question:
I am creating a REST API and I need to submit some metadata data along with a PDF file in a single POST request.
But if you are creating the API, you are not making the request - instead, you are configuring the server to return a response to that request (and choosing the MIME type that will be associated with that request).
This could be an on-topic question if it were about actually writing code to generate the response and specify a MIME type in that response. But a question asking what which MIME type you should use, would most likely be closed as primarily opinion-based. And understanding the intended purpose of each, has nothing to do with the actual mechanics of applying one or the other - it is, again, understanding a concept in networking, not in programming.
In general, design and architecture questions are a poor fit for Stack Overflow. (When they're objective and topical enough, they're usually not properly focused.) For questions that aren't an obvious fit for a more specialized site (such as Super User, Server Fault or PLDI SE), consider Software Enginering SE.
Aside from that, "what is the difference" questions are usually misguided on Stack Exchange sites in general. I don't think that applies in your specific case, but it's important to watch out for the problem of accidentally asking two questions in one. Often these questions embed a false assumption that the two things are related in some meaningful way at all; or are too vague about that relationship. There could be multiple differences, or there might not be any sane way to compare the two things. "What is the difference between X and Y?" often can't be answered any better than separately answering "What is X?" and "What is Y?"; those are two separate questions, and "what is" is generally not going to be specific enough for either question. If you mean "what is the practical effect of specifying MIME type X for the client?", then you should be explicit about that - but there's still not a lot that can be said about this unless you specify a client.
Additionally, I have seen many other questions of a very similar nature that were received very well by the community
We commonly get this objection. Most of the questions you're highlighting are quite old. Stack Overflow has narrowed in focus historically along with the creation of more specialized sites, as well as a general discovery on Meta of a consensus about how Stack Exchange sites are intended to operate. But also, the community's rules and regulations are applied mainly on a volunteer basis, and by consensus, so perfect agreement can't be expected.
But also, some of the questions you've highlighted simply aren't as similar as you think. For example, What determines whether a file should be application/octet-stream vs text/plain? is actually about the heuristics used by the libmagic
system library - which can also be used through the file
executable included with typical Linux distributions, but also through the python-magic Python binding. The question shows code using Python to access this library, and is asking about other ways to check whether something "is a text file" (admittedly not very well-defined), so it's clearly a programming question.
multipart/form-data
, so don't need help. My objective to expand my knowledge so I can make a more informed decision. That's why the question is, "what is the difference?" and not, "which is better?" Yes, I did edit the question to eliminate the "why might one be used over the other?" because you were correct about that piece being opinion based. Can you please help me understand how the "what is the difference?" piece is too broad? The questions I linked above seem to be of the same nature, and they were well received...