rest - PUT Request not happening at all in Fantom -


i having trouble put requests google sheets api. have code

    spreadsheet_inputer := webclient(`$google_sheet_uri_cells/r3c6?access_token=$accesstoken`)     xml_test := xdoc{     xelem("entry")        {          addattr("xmlns","http://www.w3.org/2005/atom")          addattr("xmlns:gs","http://schemas.google.com/spreadsheets/2006")          xelem("id") { xtext("https://spreadsheets.google.com/feeds/cells/$spreadsheet_id/1/private/full/r3c6?access_token=$accesstoken"), },          xelem("link") { addattr("rel","edit");addattr("type","application/atom+xml");addattr("href","https://spreadsheets.google.com/feeds/cells/$spreadsheet_id/1/private/full/r3c6?access_token=$accesstoken"); },          xelem("gs:cell") { addattr("row","3");addattr("col","6");addattr("inputvalue","testing 123"); },        },     }      spreadsheet_inputer.reqheaders["if-match"] = "*"     spreadsheet_inputer.reqheaders["content-type"] = "application/atom+xml"     spreadsheet_inputer.reqmethod = "put"     spreadsheet_inputer.writereq     spreadsheet_inputer.reqout.writexml(xml_test.writetostr).close     echo(spreadsheet_inputer.resstr) 

right returns

sys::ioerr: no input stream response 0 

at echo statement.

i have necessary data (at least i'm pretty sure) , works here https://developers.google.com/oauthplayground/

just note, not accurately update calendars.

edit: had return response code , 0, pointers on means google sheets api? or fantom webclient?

webclient.rescode non-nullable int 0 default hence problem either request not being sent or response not being read.

as writing request, problem should latter. try calling webclient.readres() before resstr.

this readres()

read response status line , response headers. method may called after request has been written via writereq , reqout. once method completes response status , headers available. if there response body, available reading via resin. throw ioerr if there network or protocol error. return this.

try this:

echo(spreadsheet_inputer.readres.resstr) 

i suspect following line cause problems:

spreadsheet_inputer.reqout.writexml(xml_test.writetostr).close 

becasue writexml() escapes string xml safe, whereas you'll want print string. try this:

spreadsheet_inputer.reqout.writechars(xml_test.writetostr).close 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -