Skip to content

Sheets API Discovery Error makes update tedious #11

@pscott-au

Description

@pscott-au

Describe the bug
When attempting to update a spreadsheet using sheets.spreadsheets.values.update API End-Point , the discovery spec specifies the valueInputOption parameter location as 'query' when the service actually requires this to be 'path'.

IE - the V4 discovery spec describes the parameter as follows:
valueInputOption
description 'How the input data should be interpreted.'
type 'string'
location 'query'

To Reproduce

my $res = $gapi_client->api_query( {
    api_endpoint_id => 'drive.files.create',
    options => {name => 'test', mimeType => 'application/vnd.google-apps.spreadsheet'}
  } )->json;

my $id = $res->{id};
my $range = 'A1:B2';

my $res = $gapi_client->api_query( {
    api_endpoint_id => 'sheets.spreadsheets.values.update',
    options => {
      spreadsheetId => $id,
      valueInputOption => 'RAW',
      range => $range,
      majorDimension => 'ROWS',
      values => [ [ qw/ hi there/ ], [ qw/ pi squared / ] ]
    }
  }
)->json;

dd $res; 

This should work, but gets an error from Google saying that it doesn't know the key value_input_option.

WORKING (but not satisfying)

my $res = $gapi_client->api_query( {
    api_endpoint_id => 'drive.files.create',
    options => {name => 'test', mimeType => 'application/vnd.google-apps.spreadsheet'}
  } )->json;

my $id = $res->{id};
my $range = 'A1:B2';

my $res = $gapi_client->api_query( {
    path => "https://sheets.googleapis.com/v4/spreadsheets/$id/values/$range?valueInputOption=RAW",
    method => "PUT",
    options => {
      majorDimension => 'ROWS', 
      values => [ [ 'hi', 'there' ], [ 'pi', 'squared'] ],
      range => $range 
  }
}
)->json;

This works, but is waaaaay too manual.

Expected behavior
Where the API spec is incorrect - there should be a way to override parts of the spec to allow proper calling without reverting to a fully manually constructed request.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions