Skip to content
This repository was archived by the owner on Jan 1, 2025. It is now read-only.
Matt Antonelli edited this page Dec 23, 2018 · 9 revisions

Another Triple Triad Tracker API

This is a RESTful JSON API designed to provide you with all of the application's available data in an API format. Use the navigation on the right to get more details on the individual endpoints.

Search

Each of the provided endpoints is searchable via Ransack-like query parameters. In order to search on a particular field, you must add a query parameter to a search endpoint that matches the following format ATTRIBUTE_PREDICATE=CRITERIA. We'll take a look at predicates in a bit, but let's have a simple example first.

Example

I want to query the Cards endpoint and find all of the cards with a name like "Y'shtola". I add the query parameter name_cont=y'shtola which will tell the API to look for all cards with a name containing "Y'shtola". This will make my API call look like the following:

https://triad.raelys.com/api/cards?name_cont=y'shtola

Predicates

The table below lists the predicates supported by the API.

Predicate Description
eq Equals
lt, lteq Less than (or equal to)
gt, gteq Greater than (or equal to)
cont Contains
start, end Starts/Ends with
in In list/range of values

Complex examples

Now that you've seen all of the predicates, let's take a look at them in action.

If I want to query the first 5 cards by their ID, I can use any of the following:

https://triad.raelys.com/api/cards?id_in=[1, 2, 3, 4, 5]
https://triad.raelys.com/api/cards?id_in=1..5
https://triad.raelys.com/api/cards?id_in=1...6

You can provide any number of query parameters and they will be AND'd together (no OR, sorry!) The following will let me find all NPCs in Kugane who were added after patch 4.0.

https://triad.raelys.com/api/npcs?location_eq=Kugane&patch_gt=4.0

Final Notes

If any of your query conditions are invalid, the API will ignore it. If you find yourself pulling back the full list of results, something is probably wrong!

Some of the more complex attributes (like those in nested objects) are not 1:1 with what you will see in the API results, and they will also be ignored. Please consult the schema information annotated within the relevant model to validate that you are using the correct columns.

If you have any issues, feel free to give me a shout on my Discord server. A link is available on the homepage of the website.


Search Limit

To limit the number of results from your search, use the limit query parameter. For example, if I only wanted the first Y'shtola card:

https://triad.raelys.com/api/cards?name_cont=y'shtola&limit=1
Clone this wiki locally