StarRailStaticAPI

StarRailStaticAPI serves StarRailRes as a static API.

Used by Relic Harmonizer.

Overview

Endpoints are broken down into 3 main components: base, language, and endpoint.

https://{base_url}/{language}/{endpoint}.json

Base URL

Start with the base URL:

vizualabstract.github.io/StarRailStaticAPI/db/

Language

Append the language code to the base URL. For example, if you want to use English, add en:

Endpoint

After selecting the language, add the specific endpoint you want to access. Here are the available English endpoints:

Full URL

This pattern will allow you to get your desired resource in the desired language.

https://vizualabstract.github.io/StarRailStaticAPI/db/en/achievements.json

Example Endpoints

Images

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.

Base Image URL

This path will allow you to access both icons and images

vizualabstract.github.io/StarRailStaticAPI/assets

Asset Path

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.

Extension already included.

Full URL

https://vizualabstract.github.io/StarRailStaticAPI/assets/image/character_portrait/1001.png

Example Images

StarRailAPI

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);
  });