Say I have a web app that has a production UI login at:
Say this app has a production RESTful API backend rooted at:
Now let's say this app has a non-production environment called, say, "dev". The "dev"/non-prod UI login would be:
But what should the non-prod RESTful API backend be rooted at?:
And why?
Of course, this is somewhat opinion based, but I would definitely prefer http://api.dev.example.com.
I would choose http://api.dev.example.com, because it relates to http://dev.example.com like http://api.example.com to http://example.com in the production environment.
This may not be the case for your specific roject (right now), but this could make your work easier, when it comes to dealing with relative paths/domain names.