I would like to send an identifier of my client libraries when calling my RESTful API. We have client libraries for Java, C#, Ruby, Python and others. For example, my Java client library could send:
User-Agent: java/1.10.2
Is it better to use the User-Agent header or a custom header just for my application? The User-Agent header seems to be used more for browsers, and I am yet to find an API that uses the header for client libraries.
EDIT
I think User-Agent
is the appropriate header in this scenario.
According to Wikipedia, User-Agent
is:
a user agent is software (a software agent) that is acting on behalf of a user... In many cases, a user agent acts as a client in a network protocol used in communications within a client–server distributed computing system. In particular, the Hypertext Transfer Protocol (HTTP) identifies the client software originating the request, using a user-agent header, even when the client is not operated by a user.
Thus, to become a User-Agent, it should be:
According to the description in question, the client library (software) is used to consume API (on behalf of a user) and handles ALL the request & response logic (client in a network protocol), which makes it perfectly follow the above definition.
Also, the usage of client library information is typically what plain browser's User-Agent
is used for.