I’ve done this in the past, and the critical section of code was this:
var url = "http://api.vexdb.io/v1/get_rankings?sku=" + sku + "&team=" + teams*;
var requestResult = UrlFetchApp.fetch(url).getContentText(); //get results of request
var formattedResult = JSON.parse(requestResult); //parse the request to create a JSON object
var results = formattedResult.result;
where
sku
was a variable containing the event’s SKU from RobotEvents and
teams*
was a specific team’s number (such as
1900X
).
Basically, first you’ll want to figure out what API request you need to make to VexDB. Then you use Google Apps Script’s
UrlFetchApp
to actually make the GET request to VexDB. You can get the text result of the request to VexDB using the
getContentText()
function. VexDB gives you a result in JSON. You can convert that to something you can interact with in JavaScript by passing it through that
JSON.parse(whatever you want to parse)
function. The last line isolates the important part of the JSON, which in this case is whatever is in the “result” property.
It’s a good idea to visit whatever URL you intend to make a request to before trying it in your code. That is, if you wanted to use a list of teams in your code, you should first visit the URL you think* will give you that data in your browser. That way, you a) know the URL actually works and b) can see the structure and format (as in JSON, XML, etc.) of the data.
Also, the Apps Script documentation and Google searches will take you a long way, as long as you know the basics of whatever you want to do (if you don’t, do some research into what an API request actually entails, and that will help you get started).
Finally, Apps Script has a [
](https://developers.google.com/apps-script/reference/base/logger#logdata) function that is incredibly useful for figuring out what's happening in the code. It's something you'll definitely want to make use of as you get into Apps Script development.*