You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Calling Admin APIs from StroreFront

edited Aug 23, 2020 12:25PM in Commerce 2 comments

Summary

Calling Admin APIs from StroreFront

Content

Hi ,

How can any Admin API s be called from Store front (from a custom widget).

I have a requirement to display all the active Promotions to storefront shoppers. So I called the API to fetch the Promotions from a Custom widget I created. but I am not getting a response as 404 page not Error is occurring . Below I have mentioned the code in which I am trying to call the rest API and also attached the Error Response I am getting.

Code Snippet

               promoUrl = "/ccadmin/v1/promotions";
                ccRestClient.request(promoUrl, promoData,
                    function(result) {
                        console.log(result.items);
                    

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!