11

When, I am hitting one API calls from Angular to Backend, the API call I can see in "Network" section of "Developer's tool"(ctrl+shift+i). I want to hide the API calls from the "network" list. As, I have seen in some websites they are hiding the API calls. Means, datas are coming but it is not being listed in the developer's tool. What should I do?

For example, hitting this websites url https://track.aftership.com/shreetirupati/115601676472 or http://www.shreetirupaticourier.net/Frm_DocTrack.aspx?docno=115601676472, is not hitting any API, does this mean they are accessing data directly from DB in front-end?

Satish Patro
  • 3,645
  • 2
  • 27
  • 53
  • This sounds like an [XY problem](https://meta.stackexchange.com/q/66377/386424). What is your end goal? Why are you trying to do this? – Igor Feb 28 '19 at 13:40
  • Well, I just want to know how deveopers achieve it. So that, if in future I want to hide APIs' I can use .Then, how come it is coming under xy problem? – Satish Patro Feb 28 '19 at 13:46
  • 1
    Possible duplicate of [Angular 5: Is there way hide API call? or make it private?](https://stackoverflow.com/questions/53630002/angular-5-is-there-way-hide-api-call-or-make-it-private) – Igor Feb 28 '19 at 13:51
  • 1
    The browser belongs to the user - not your website – Jonas Praem Feb 28 '19 at 13:54
  • Ok. But, what about the websites I saw that data is displaying. But, not showing in any API call response of that displayed data? – Satish Patro Feb 28 '19 at 14:12
  • @Igor, it is not any sub vague problem. I have just asked one direct problem statement which shadowman_93 answered – Satish Patro Feb 28 '19 at 14:14
  • 1
    My suggestion would be that you encrypt and decrypt on angular and on the backend side this way data will go encrypted and will be harder to translate. But this require access to both the aplication and the api service code. – Swoox Feb 28 '19 at 14:38
  • 3
    @SatishPatro don't mind these guys always attacking people's question and finding faults rather than trying to answer or help. That is why they spend most of their time commenting rather than creating an answer if they think they know it all – uberrebu Aug 25 '22 at 22:19

3 Answers3

5

I agree with the @shadowman_93 answer above.

There is no way to hide the Network API calls from a browser. And if you want to achieve this in a way, then use Server-side rendering like many popular sites do (Amazon, Airbnb, etc.) Also, if you've used Service Workers then it is possible that few parts of your application might still show the API calls after the first load (generally happens with SPAs).

You can also make your SEO better if you use Server-side rendering as it helps Google crawlers to fetch the important content on the first load of your website.

Zoe
  • 27,060
  • 21
  • 118
  • 148
saberprashant
  • 388
  • 5
  • 15
2

There is nothing that you can do for hiding service calls from Chrome DevTools. You can only authenticate user if you want to provide secure calls.

Recommend you to read this: stackoverflow.com/a/53630102/5955138

rcanpahali
  • 2,565
  • 2
  • 21
  • 37
2

You can't hide api calls from network tab but you can do a trick with signalR /websocket to minimize visible API calls.

You will need to create "Get" "Post" etc method at server side and call them from client and pass data.

I would suggest to use this workaround only for APIs having less data transfer.

Ashish Gehlot
  • 483
  • 8
  • 16