来自JavaScript的Acces Prestashop webservice [英] Acces Prestashop webservice from JavaScript

查看:206
本文介绍了来自JavaScript的Acces Prestashop webservice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Prestashop后端,我激活了webservice,我创建了一个验证密钥。

In the Prestashop backend I activated the webservice and I created an authentication key. Testing in browser works well but now I want to access the webservice via JavaScript in a Cordova application.

我得到的回应是 401(未经授权的),在浏览器中测试效果良好,但现在我想通过JavaScript在Cordova应用程序中访问web服务。 )。我使用AngularJS执行这个ajax调用:

The response I am getting is 401 (Unauthorized). I'm performing this ajax call (using AngularJS):

$http.get('http://AUTHENTICATION_KEY@url.com/api/employees/2', {})

如何发送验证密钥?

我一直在网上搜索,但我没有发现任何有趣的解决我的问题。

I've been searching on the Internet but I did not found anything interesting that solves my problem.

推荐答案

最后,我想出了如何发送ws_key:

Finally, I figured out how to send the ws_key:

$http({
        method: 'get',
        url: ws_url + 'customers/?schema=blank',
        params: {
            ws_key: ws_key
        });

您必须使用您的密钥传递ws_key param才能访问PrestaShop Web服务。

You have to pass the ws_key param with your key to access the PrestaShop webservice.

这篇关于来自JavaScript的Acces Prestashop webservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆