Casey
December 12, 2022, 11:03pm
1
Hello,
I am working on a few appscript functions in Google Sheets to access The Blue Alliance data.
I have not been able to get ETag and If-None-Match Header to work.
Does anyone have an example I can look at that checks whether data has changed?
I have gotten the ETag with a W in front of it: W/“900cc8acb24b1c43ba74d061345260c317dcd610”
And have tried passing that as part of the header, as well as removing the W/ and just passing in the string.
The ETag has not changed, but both ways have a 200 return code.
Thanks,
Casey
Casey
December 12, 2022, 11:13pm
2
And it does seem to work on command line:
wget --header=“X-TBA -Auth-Key: 2**” --header=“If-None-Match: 900cc8acb24b1c43ba74d061345260c317dcd610” https://www.thebluealliance.com/api/v3//event/2023txhou/teams/simple
…
2022-12-12 17:09:22 ERROR 304: Not Modified.
So, I am doing something wrong in the appscript, but I know that the header is being set correctly, because it sends the key.
Casey
December 12, 2022, 11:43pm
3
Here’s the code:
// This google appscript will enable pulling data from The Blue Alliance
// in order to combine it with data that is gathered through scouting.
//
// Inspired by: https://github.com/Eiim/tba-requests
//Properties service holds the TBA key in a user specific property service,
// And the Event key in a document specific property store.
var documentProperties = PropertiesService.getDocumentProperties();
var userProperties = PropertiesService.getUserProperties();
// ui allows us to send messages and get responses
function onOpen() {
const ui = SpreadsheetApp.getUi();
ui.createMenu('ausTIN CANalytics')
.addItem('TBA API Key','readAPIKey')
.addItem('Event Key and Initialize', 'initEvent' )
.addItem('Set Team Key','readTeamKey')
.addItem('Reset API Key','resetAPIKey')
.addSeparator()
This file has been truncated. show original
It’s still in a rough place, but the TBAQuery routine runs. Obeys max-age, just always gets a 200 when passing an ETag.
Casey
December 13, 2022, 3:07am
4
Figured it out.
If you have a URL with duplicate path separators, then UrlFetchApp will Not return 304.
Wget doesn’t care. Not sure that HTTP(s) cares.
But Appscript apparently cares.
system
Closed
December 13, 2023, 3:07am
5
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.