Appscript or javascript of TBA using ETag?

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

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.

Here’s the code:

It’s still in a rough place, but the TBAQuery routine runs. Obeys max-age, just always gets a 200 when passing an ETag.

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.

:person_shrugging:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.