@@ -73,31 +73,38 @@ feature -- Spreedsheets Operations
7373 require
7474 not a_spreadsheet_id .is_empty
7575 local
76- l_param : STRING
76+ l_file : PLAIN_TEXT_FILE
7777 l_params : STRING_TABLE [STRING ]
78- l_tuple : like parameters .item
7978 do
79+
8080 logger .write_information (" Now getting sheet from id:" + a_spreadsheet_id )
81- l_param := " includeGridData=true"
82- l_param .append (" &fields=sheets.properties" )
8381 create l_params .make (2 )
84- l_params .extend (" includeGridData" , " true" )
85- l_params .extend (" fields" , " sheets.properties" )
86- create l_tuple
82+ l_params .extend (" true" , " includeGridData" ) -- all content
83+ -- l_params.extend ("sheets.properties", "fields") -- properties only
8784
8885 api_get_call (sheets_url (" spreadsheets/" + a_spreadsheet_id , Void ), l_params )
8986 check
9087 attached last_response as l_response and then
9188 attached l_response .body as l_body
9289 then
90+ parse_last_response
9391 if l_response .status = {HTTP_STATUS_CODE }.ok then
94- parse_last_response
9592 Result := l_body
93+
94+ create l_file .make_create_read_write (" /tmp/hitme_sheet_json.json" )
95+ logger .write_information (" get_from_id->Writing body into " + l_file .path .utf_ 8 _name )
96+ l_file .close
97+ l_file .wipe_out
98+ l_file .open_append
99+
100+ l_file .put_string (l_body )
101+ l_file .close
96102 elseif l_response .status = {HTTP_STATUS_CODE }.not_found then
97103 logger .write_error (" get_from_id-> Not found:" + l_response .status .out + " %NBody: " + l_body )
98104 else
99105 logger .write_error (" get_from_id-> Status code invalid:" + l_response .status .out + " %NBody: " + l_body )
100106 end
107+
101108 end
102109 end
103110
@@ -137,7 +144,11 @@ feature -- Error Report
137144 check
138145 attached last_response as l_response
139146 then
147+ if l_response .status = {HTTP_STATUS_CODE }.unauthorized then
148+ logger .write_error (" parse_last_response->Unauthorized status, review your authorization credentials" )
149+ end
140150 if attached l_response .body as l_body then
151+ logger .write_debug (" parse_last_response->body:" + l_body )
141152 create l_json_parser .make_with_string (l_body )
142153 l_json_parser .parse_content
143154 if l_json_parser .is_valid then
0 commit comments