如何格式化Rexster POST以向Titan图形添加边



我正在尝试使用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."}

请求中的格式问题在哪里?

你能改变你的angularjs代码POST请求作为JSON(而不是格式化参数查询字符串)?将你的Content-Type设置为application/json(尽管angular可能已经为你这样做了)。这些应该能解决你的问题。

最新更新