CircuitVerse / CircuitVerse-Presentation-Embed

MIT License
9 stars 6 forks source link

[BUG] Google Slides Add On - Issue in Backend API #17

Closed satu0king closed 3 years ago

satu0king commented 3 years ago

The add on takes URL of the simulator, extracts id or friendly slug depending on the URL type and performs a query to extract image. However, the API gets the image based on id. So it cannot get the image based on friendly slug.

function getCircuitImagePath(id) {
  var queryUrl = `circuitverse.org/api/v1/projects/${id}/image_preview`;
  return JSON.parse(UrlFetchApp.fetch(queryUrl))["project_preview"];
}

File of API usage: https://github.com/CircuitVerse/CircuitVerse-Presentation-Embed/blob/5b7d02aaec4a662749c1a3a26dd425a2cb6db136/Google%20Slides%20Add%20On/Code.js#L42

I think there are a few options

  1. Modify API to work with both friend slug and id
  2. Create a new API which works with both friendly slug and id
  3. Create another API which gives ID, given slug

@tachyons, @Nitish145 any inputs here?

tachyons commented 3 years ago

api was supposed to accept both slug and id, current behavior is a bug