razorranjan Posted July 8, 2015 Share Posted July 8, 2015 Hello guys, I recently developed an app using cordova, angularjs, ionic framework, angular material for wordpress site. Wordpress returned json data via their api plugin and angular works on json data so there were no problems while building the app. Now i want to build an e-commerce app using cordova,angularjs,ionic framework,angular material for prestashop. The main concern for me is that prestashop returns xml response for the api calls made. Is there any way i can reterive json data using the webservice that prestashop provides. Please guide me through this so that i can contribute my app for free after the development. Prestashop version: 1.6.0.9 Thanks. Link to comment Share on other sites More sharing options...
razorranjan Posted July 9, 2015 Author Share Posted July 9, 2015 (edited) Note: website i am using here is on local machine. okay i figured it out for getting response in json format using the below link key@domainname/api/products/?output_format=JSON its gives me json data but when i try to access the same using angularjs i get error. I tried it in two ways. 1.using var get_products = 'http://[email protected]/api/products/'; $http.get(get_products).success(function(response){ console.dir(response); }); Error: Access to restricted URI denied. 2. using var ws_url = 'http://prestashop.net' ; var ws_key = 'key' ; $http({ method: 'get', url: ws_url + '/api/products/', params: { ws_key: ws_key } }); XML Parsing Error: no element found Location: moz-nullprincipal:{05e14370-efc4-4149-8c65-33d77604d6b2} Line Number 1, Column 1: Can anybody tell me where i am getting it wrong. I tried the 2nd method from the link : http://stackoverflow.com/questions/24798902/acces-prestashop-webservice-from-javascript as the guy had the same situation like i have. Edited July 9, 2015 by ranjankumar sahoo (see edit history) Link to comment Share on other sites More sharing options...
razaro Posted July 9, 2015 Share Posted July 9, 2015 I was playing with some other js framework but had similar issue, but this worked for me. Also used http.get but try with this as url var get_products = 'http://your-store-name.com/api/products?ws_key=YOUR_KEY&output_format=JSON'; For some reason that worked for me. Hope it helps and you have success in making an app. Link to comment Share on other sites More sharing options...
razorranjan Posted July 9, 2015 Author Share Posted July 9, 2015 I tried it the way u just instructed but now i get 500 error. "NetworkError: 500 Internal Server Error - http://prestashop.net/api/products?ws_key=T1QI2PA4ZLXXI5EUVEKA2XQR4NZB9YLW&output_format=JSON" but if i open the same link in the browser it returns the json data. Link to comment Share on other sites More sharing options...
razaro Posted July 9, 2015 Share Posted July 9, 2015 Sorry what is your store domain ? You can PM me link and api key, because key you should not post like that to public. Link to comment Share on other sites More sharing options...
razorranjan Posted July 9, 2015 Author Share Posted July 9, 2015 thanks for the concern but the website is on my local machine. i will be changing the key while making it online. the domain is different online. i will pm u the details in few mins. Link to comment Share on other sites More sharing options...
razorranjan Posted August 7, 2015 Author Share Posted August 7, 2015 can you please let me know the solution @razaroi had sent you the details. Link to comment Share on other sites More sharing options...
rfbabeheer Posted September 17, 2015 Share Posted September 17, 2015 I'm also working on a project like this. do someone know the implementation of customer login in angular using prestashop api? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now