2

我有一个可以使用 curl 调用的 RESTful PUT API,如下所示:

curl -H "Content-Type: application/json" -X PUT -d "{\"id\":\"xyz\",\"attributeName\":\"privilegedUser\",\"attributeValue\":\"true\"}" https://www.example.com:7777/api/customer/set/attribute -v --insecure --negotiate -u:

我是 Backbone 的新手。我试图通过使用这样的 Backbone 从 JS 调用相同的内容(但它不起作用):

var Attribute = Backbone.Model.extend({
    url: 'https://www.example.com:7777/api/customer/set/attribute'
});

var privilegeUserAttribute = new Attribute({id: "xyz", attributeName: "privilegedUser"});

privilegeUserAttribute.save({attributeValue: "true"});

我究竟做错了什么?

4

0 回答 0