java - Error on POST with Restangular -
I want to send a front end application with a complex JSON object to end the POST request.
Back and Side
I have a class called a notification service and there is a method named after writing a note:
@ POST @Path (SERVICE_PATH_WRITENOTIFICATION) Public Response Written Notice (@formaparam ("Notification") String Notification)
Front End Side
I send it to:
var obj = [[to: $ scope.formComboDestinatari.listaDestinatari, subject: $ scope.formOggetto, date: "xxx", body: $ scope .formTesto, type: $ scope.formComboTipologia}];
If I use this syntax:
restangelular.one ('Server Path / Ryanotification'). Post (obz);
When I try to send the request, I get this error:
500 internal server error
If I use this syntax:
restangular.one ('serverpath'). Post ('written notice', obg);
400 bad request
I do not understand where my fault is.
I have done wrong twice.
First:
This should not be in obj
var because one represents the array.
Then the definition is:
var obj = {to: $ scope .formComboDestinatari.listaDestinatari, subject: $ scope.formOggetto, date: "xxx", body: $ Scope.formTesto, type: $ scope.formComboTipologia};
Second:
Instead of now, I now use $ http like this:
$ http ({url) : "Application / Jason; Charset = UTF-8", "Accept": "Application / Jason"}}) successfully (function (data) {$ scope.items = data; alert ('notifica inviata');} ) Error (function (data) {warning ('Invio notifica fallito');});
Comments
Post a Comment