Reputation: 3341
I am trying to get the developer metadata about a spreadsheet using the Google Script API, as found on this website.
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata/search
I have tried the following, however I am getting no response back? Can anyone see where I am going wrong?
var ss = SpreadsheetApp.getActiveSpreadsheet();
var fileId = ss.getId();
var token = ScriptApp.getOAuthToken();
var paramsPost = {
method: 'post',
headers: {
Authorization: 'Bearer ' + token
},
muteHttpExceptions: true,
contentType: 'application/json',
payload: JSON.stringify({
dataFilters: [{
developerMetadataLookup: {
locationType: 'COLUMN'
}
}]
})
};
var url = 'https://sheets.googleapis.com/v4/spreadsheets/' + fileId + '?developerMetadata:search';
var res = UrlFetchApp.fetch(url, paramsPost);
var data = JSON.parse(res.getContentText());
Upvotes: 1
Views: 886
Reputation: 201378
In order to use the method of spreadsheets.developerMetadata.search of Sheets API, please modify the endpoint as follows.
var url = 'https://sheets.googleapis.com/v4/spreadsheets/' + fileId + '?developerMetadata:search';
var url = 'https://sheets.googleapis.com/v4/spreadsheets/' + fileId + '/developerMetadata:search';
?
of '?developerMetadata:search'
is /
.Upvotes: 1
Reputation: 8964
You no longer need to use the REST API directly to access developer metadata.
As of November 14, 2018, methods to access developer metadata were added to the built-in Spreadsheet service. See Release Notes for details.
Upvotes: 1