It is currently 22 April 2025, 10:38 Advanced search

Chiamata Put con XML passato in raw

Domande e risposte su come utilizzare Instant Developer Cloud al meglio

Chiamata Put con XML passato in raw

Postby A.Piunti » 3 December 2018, 17:13

Salve,
ho l'esigenza di eseguire una chiamata PUT passando del testo xml nel body.
L'xml va passato non con un parametro chiave-valore, ma un raw di tipo xml.

L'equivalente di una chiamata ajax tipo:

Code: Select all
$.ajax({
    url: url,
    data: "<prestashop>...</prestashop>",
    type: 'PUT',
    contentType: "text/xml",
    dataType: "text",
    success : function ....,
    error : function ...
});


è possibile farlo in indeCloud?
Se si come?
User avatar
A.Piunti
 
Posts: 317
Joined: 1 January 2015, 13:20

Re: Chiamata Put con XML passato in raw

Postby m.sirri » 6 December 2018, 8:03

Direi che si fa così:

Code: Select all
var url = app.fs.url(url);
var options = {};
options.bodyType = "text/xml";
options.body = "<prestashop>...</prestashop>";
yield url.put(options);
User avatar
m.sirri
Pro Gamma
Pro Gamma
 
Posts: 8574
Joined: 30 September 2010, 17:01
Location: Ozzano dell'Emilia (BO)

Re: Chiamata Put con XML passato in raw

Postby A.Piunti » 6 December 2018, 10:14

m.sirri wrote:Direi che si fa così:

Code: Select all
var url = app.fs.url(url);
var options = {};
options.bodyType = "text/xml";
options.body = "<prestashop>...</prestashop>";
yield url.put(options);


Perfetto, funziona
Grazie Matteo
User avatar
A.Piunti
 
Posts: 317
Joined: 1 January 2015, 13:20

Re: Chiamata Put con XML passato in raw

Postby m.sirri » 6 December 2018, 10:48

Figurati. Buon lavoro.
User avatar
m.sirri
Pro Gamma
Pro Gamma
 
Posts: 8574
Joined: 30 September 2010, 17:01
Location: Ozzano dell'Emilia (BO)


Return to Tips & Tricks - Cloud

Who is online

Users browsing this forum: No registered users and 9 guests