0

I am just looking for the most appropriate way to indicate with HTTP POST my content type.

I have csv files. They may have 1 line or they may have multiple lines. As I am implementing the server side of this, distinguishing between the two can make my implementation a bit cleaner.

text/cms+csv

Is what I have but that doesn't indicate how many entities exist in the payload. Do I use a custom param?

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98
Christian Bongiorno
  • 5,150
  • 3
  • 38
  • 76

1 Answers1

2

There is no requirement to indicate the number of entities in a request payload. If you are uploading multiple files in a single request, then each file in that request will have a corresponding entity. Each entity in the request would then include its content-type, etc. This StackOverflow post shows an example.

If I understand your case correctly, you are uploading a single csv which may or may not have multiple lines. There is no header that describes this. The closest header to your case is arguably the Content-Length header. This header indicates the size of an entity body.

To answer your question more directly, if you really need the line count, you might create a custom header. And as for an appropriate Content-Type, you should consider text/csv.

Community
  • 1
  • 1
cmd
  • 11,622
  • 7
  • 51
  • 61