Why can't I create an API from a web frontend?

Hi team,

I am using cli to generate extension it works, however when I try to get products on web frontend by changing

/api/products/count

to

/api/products

The error is

No shop provided

Could you help?

Thank you very much