A stateless Google Apps Script library to access the PSS Fleet Data API. Currently supported API version is 1.5.x.
- Easy access to the official PSS Fleet Data API server.
- Fast setup to get you started quickly.
To retrieve the last month's tournament results (a specific Collection):
// Retrieve the monthly results in reversed order and take only 1
let apiResponse = PssFleetData.getCollections(null, null, "month", true, 0, 1);
// The resulting response object will have the http response code and if the request was successful, also the parsed response body
if (apiResponse.metadatas != null) { // Check for null, the result set may just be empty
// Now retrieve the Collection's full data with the collectionId
let collection = PssFleetData.getCollection(apiResponse.metadatas[0].collectionId).collection;
if (collection) {
console.log("Last month's collection was collected at: " + collection.timestamp);
console.log("Last month's collection took " + collection.duration + " seconds");
console.log("Last month's collection has " + collection.alliances.length + " alliances");
console.log("Last month's collection has " + collection.users.length + " users");
}
}
The library converts localized Date
objects to UTC or assumes UTC, if no timezone information is given. Any Date
objects returned are in UTC.
To install the library in your project, follow the steps outlined in the official documentation. When prompted for the script ID enter:
1THzQ0jC6YrA2SyWMrHf1QauQdKYI4eMK4H-LhP6s1a9i5UvRa7p3TiaQ
Then select the latest numbered version.
If you ran across a bug or have a feature request, please check if there's already an issue for that and if not, open a new one.
If you need help using the library or want to contribute, you can join my support Discord at: discord.gg/kKguSec