You can either use your private network address when accessing the web traffic (e.g. 192.168.x.xxx, 10.x.x.x, 172.16.x.x) or map a hostname to 127.0.0.1 in the hosts file.
EDIT: I should mention that if the API is listening only on 127.0.0.1 then the hosts file should be changed. If you can't change the host file for whatever reason another option is to have the service listen to 0.0.0.0:8080 and then request using the private network address.