53

What's the difference between using application/csv vs text/csv as the HTTP Accept Header?

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Glide
  • 20,235
  • 26
  • 86
  • 135
  • 1
    This question appears to be off-topic because it is not programming related. – Daniel A. White Sep 21 '13 at 01:04
  • 10
    @DanielA.White It is related because I need to know the distinction in order to set the appropriate header in my Java service layer. – Glide Sep 21 '13 at 01:06
  • 4
    Whoever marked this as a duplicate and pointed to the "other" answer is incorrect (at least as far as the current question is stated/edited - it may have been a duplicate originally). The other "answer" does not even mention "application/csv". – Toby May 04 '17 at 17:20

2 Answers2

80

A MIME type is used so software ( like a browser for example ) can know how to handle the data.

If a server says "This data is of type text/csv" the client can understand that can render that data internally, while if the server says "This data is of type application/csv" the client knows that it needs to launch the application that is registered on the OS to open csv files.

text/csv is more generic.

G-Man
  • 7,232
  • 18
  • 72
  • 100
16

text/csv is more appropriate because application as a first part implies some interactivity. Your text file not being interactive, it should be announced as text.

Sergei Basharov
  • 51,276
  • 73
  • 200
  • 335
zneak
  • 134,922
  • 42
  • 253
  • 328