I'm trying to retrieve data from an HTTP adapter using the new REST API.
this is some of my JSON objects returned:
"items": [
{
"category": "category 1",
"produit": [
{
"id": "57",
"name": "this is my name",
"answer": [
{
"id": "146",
"answername": " answer 1",
"istrue": "0",
"questionid": "57"
},
{
"id": "147",
"answername": "answer 2",
"istrue": "0",
"questionid": "57"
}
]
}
]
}
]
When I invoke the procedure using WL.Client.invokeProcedure(invocationData, options);
it works fine.
var invocationData = {
adapter : 'AuthentificationAdapter',
procedure : 'getquestion',
parameters : [jsontab],
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : $.proxy(function(data)
{
deferred.resolve(data.invocationResult.items);
},this),
onFailure : $.proxy(function(error)
{
deferred.reject(error);
},this)
});
return deferred.promise
But when I used the REST API it returns with Failed to read the HTTP response
and Failed to parse JSON string
here is my resource request code:
var resourceRequest = new WLResourceRequest("/adapters/AuthentificationAdapter/getquestion", WLResourceRequest.POST, 30000);
resourceRequest.setQueryParameters(jsontab);
resourceRequest.send().then(
$.proxy(function(data) {
deferred.resolve(data.responseJSON.items);
},this),
$.proxy(function(error) {
deferred.reject(error);
},this)
);
return deferred.promise;
It seems that the REST API doesn't support complete JSON object as a return like WL.Client do?