Jack L.
Jack L.

Reputation: 1335

Shortening RESTful response

Suppose I create an API endpoint, which gives me following response:

 [
     {
         "timestamp": 123456789,
         "average": 0.0123456789
     },
     ^^ many times 
]

Can I shorten the labels, like: "timestamp" to "t" and "average" to "avg" to save transfer. I mean, I know I can, but the question is: is such an attempt correct as to RESTful standards?

Upvotes: 0

Views: 59

Answers (1)

gitaarik
gitaarik

Reputation: 46320

RESTful standards don't give you any restriction on the way you represent your data. If you documented it well enough I don't see a problem in your approach. You can even make it lists:

[
    [123456789, 0.0123456789],
    [123456789, 0.0123456789],
    [123456789, 0.0123456789],
    [123456789, 0.0123456789]
]

Upvotes: 1

Related Questions