我正在尝试使用 AngularJS 资源向我的 Titan Server 0.4.4 图表添加一条边。资源如下所示:
'use strict';
angular.module('storymapApp').factory('edgeResource', function ($resource) {
var EdgeResource = $resource('http://localhost:8182/graphs/graph/edges?_outV=:outId&label=:label&_inV=:inId', {outId: "@outId", inId: "@inId", label: "@label"}, {
update: {method: 'PUT', isArray: false},
outedge: {method: 'POST',
transformResponse: function(data, headers){
// deserialize the JSON response string
data = angular.fromJson(data);
data = data.results;
return data;
},
isArray: true}
});
return EdgeResource;
});
这段代码生成一个像这样的 POST:
http://localhost:8182/graphs/graph/edges?_outV=120028&label=contains&_inV=160076
它返回以下 500 错误消息:
{"message":"An error occurred while generating the response object","error":"Edge cannot be found or created. Please check the format of the request."}
请求中的格式问题在哪里?