When calling REST or web (SOAP) services it is a bad practice to hard-code the endpoints. Endpoints can change and it is very likely that different endpoints need to be used for test and production. In both of these use cases, it is preferable to use a constant for the endpoint.
Noncompliant solution:
Compliant solution: