StarRailStaticAPI serves StarRailRes as a static API.
Used by Relic Harmonizer.
Endpoints are broken down into 3 main components: base, language, and endpoint.
https://{base_url}/{language}/{endpoint}.json
Start with the base URL:
vizualabstract.github.io/StarRailStaticAPI/db/
Append the language code to the base URL. For example, if you want to use English, add en:
cn
cht
de
en
es
fr
jp
kr
pt
ru
th
vi
After selecting the language, add the specific endpoint you want to access. Here are the available English endpoints:
achievements
avatars
character_promotions
character_ranks
character_skill_trees
character_skills
characters
descriptions
elements
items
light_cone_promotions
light_cone_ranks
light_cones
nickname
paths
properties
relic_main_affixes
relic_sets
relic_sub_affixes
relics
simulated_blessings
simulated_blocks
simulated_curios
simulated_events
This pattern will allow you to get your desired resource in the desired language.
https://vizualabstract.github.io/StarRailStaticAPI/db/en/achievements.json
Many of the resources with endpoints have references to images and icons. This project’s sole focus is to serve files as they are from their source repos.
Because of this, I’ve limited myself to only moving folders into directories I feel will make consumption of the API easier to understand.
This means zero file editing.
https://{base_image_url}/{asset_path}
So while the data may provide an image URL, it’s only a path. For example, March 7th:
"1001": {
"id": "1001",
"name": "March 7th",
"tag": "mar7th",
"rarity": 4,
"path": "Knight",
"element": "Ice",
"icon": "icon/character/1001.png",
"preview": "image/character_preview/1001.png",
"portrait": "image/character_portrait/1001.png"
}
Here, there are 3 asset files associated with her: an icon and two images.
To access their images, you’ll need to prefix each URL with the base path to the asset directory, then append these paths to get the full image URL.
This path will allow you to access both icons and images
vizualabstract.github.io/StarRailStaticAPI/assets
As long as you use the path directly provided by the endpoint, you shouldn’t have any issues accessing the image file. Each one already comes prefixed with either icon
and image
, matching the directory structure of the assets folder.
icon/character/1001.png
image/character_portrait/1001.png
Extension already included.
https://vizualabstract.github.io/StarRailStaticAPI/assets/image/character_portrait/1001.png
I created a query client to give users an easy way to use and work with the data found here. Using a series of chainable methods, you’ll be able to combine several of the endpoints into a useable data object. This should make it easier to work with this otherwise fragmented data.
See VizualAbstract/star-rail-api for more detials
Example
import { CharacterIDs, CharactersClient } from "star-rail-api";
const characters = new CharactersClient();
characters
.withRanks()
.withSkills()
.withSkillTrees()
.withImages()
.getByID(CharacterIDs.DanHengImbibitorLunae)
.then((resp) => {
window.console.log(resp);
})
.catch((error) => {
window.console.error(error);
});