question

cipriantk avatar image
cipriantk asked

Http "PUT" request ?

cand i make a "PUT" request using http.request ? i am trying but i'm getting errors, it works fine with POST and GET

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Yes, I've just tested a PUT request from Cloud Script. What are the specifics of the error you're getting?

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

cipriantk avatar image cipriantk commented ·

var headers = {}; headers["Accept"] = "application/json;odata=nometadata";

http.request(LINK ,"PUT", "{\"a\":\"Playeri\",\"b\":\"c\",\"d\":\""+Reshow+"\"}", "application/json",headers);

I tried to do a try catch but the error returns "undefined", the weird thing is that if I change the "PUT" to "GET" it works.

I am trying to connect to Azure Tables.

0 Likes 0 ·
brendan avatar image brendan cipriantk commented ·

One difference between a GET and a PUT is that a GET request doesn't have a body, so that part wouldn't be evaluated in that case. What I would recommend is building the body as a separate object, which you then pass into the call with a toString operation.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.