CityScope / CS_CityIO

Serverside script for the cityscope platform
https://cityio.media.mit.edu
14 stars 8 forks source link

Change in hidden table API? #109

Closed RELNO closed 4 years ago

RELNO commented 4 years ago

https://cityscope.media.mit.edu/CS_CityIO/ can no longer fetch hidden-table thus it returns an error.

yasushisakai commented 4 years ago

what do we mean by Lat-Lng API?

yasushisakai commented 4 years ago

curl -H "Authorization:Bearer {SECRET}" https://cityio.media.mit.edu/api/table/hidden_table | jq '.header'

tells me there is no location. (jq is a JSON parser for command line) why are we able to see the hidden_table's contents in the frontend in the first place...??

RELNO commented 4 years ago

Wrong title -- the issue is with hidden tables.

In the current version of cityIO FE, this is how we get a table:

/**
 * get cityIO method [uses polyfill]
 * @param cityIOtableURL cityIO API endpoint URL
 */
async function getCityIO(url) {
  var myHeaders = {
    headers: new Headers({
      Authorization:
        "Bearer ________"
    })
  };

  return fetch(url, myHeaders)
    .then(function(response) {
      return response.json();
    })
    .then(function(cityIOdata) {
      return cityIOdata;
    })
    .catch(err => {
      console.log(err);
    });
}

Bearer is hardcoded in the FE. We agreed on getting it this way, since we otherwise cannot parse

  let cityIOurl = "https://cityio.media.mit.edu/api/tables/list";
  const tables = await getCityIO(cityIOurl);

What is an alternative to this? is there a way for me to know in advance which table is hidden?