Sorakthun Ly
Sorakthun Ly

Reputation: 732

REST URIs case and payload case

From what I've read, it's common to use hyphen and underscore as a delimiter for a URI name

/some-resources or /some_resources

My web apps and backend are in JS and so I use camelCase naming convention. That means for any field queries or request payload. The information will be in a different case than the path URI.

/some-resources?someAttribute=something

Is this considered a bad design?

I see that IBM does something like this:

/some_resources?someAttribute=something

Is it worth to convert my REST APIs query attributes and payload to be kebab-case and then have a layer in my REST backend to normalise the attributes to camelCase so that it can process the information?

Upvotes: 1

Views: 62

Answers (1)

Evert
Evert

Reputation: 99687

There is no real difference in what kind of casing is used, only personal preference. If an API were ALL-CAPS screaming at me I might be biased to think that other things might be wrong with an api... but for the examples you mention, different server-side technologies tend to favor different casing and none are wrong.

But I would slightly prefer to pick whatever is the most popular in my ecosystem.

Upvotes: 1

Related Questions