fimfiction-issues icon indicating copy to clipboard operation
fimfiction-issues copied to clipboard

API categorizing character tags

Open Lithl opened this issue 7 years ago • 2 comments

GET /api/v2/story-tags?filter[type]=character

The above endpoint returns a flat list of character tags. There is no data to allow consuming code to automatically group the tags in the same fashion as the site UI does (eg, "Main Cast" with tags 6, 7, 8, 9, 10, 5, 15, 73; "Cutie Mark Crusaders" with tags 12, 13, 14, 74, 83; and so on). As-is, a client presenting available tags to a user can't really do better than manually encoding the groups (which would become incorrect as soon as the site adds new character tags or rearranges the groups), or else presenting the tags in alphabetical order.

Adding a field like "group" (similar to the current "type" field) would allow a client to at least group the tags correctly, even if they're not in the correct order within the group. (See above with the Main Cast group, with an order that goes from 10 to 5 to 15.) Also adding a field like "group_order" would allow a client to get the correct ordering within a group, as well. Thus, the result set from the story-tags endpoint would look something like:

{
    "data": [
        {
            "id": "5",
            "type": "story_tag",
            "attributes": {
                "name": "Fluttershy",
                "type": "character",
                "group": "Main Cast",
                "group_order": 5
            }
        },
        {
            "id": "6",
            "type": "story_tag",
            "attributes": {
                "name": "Twilight Sparkle",
                "type": "character",
                "group": "Main Cast",
                "group_order": 0
            }
        },
        {
            "id": "7",
            "type": "story_tag",
            "attributes": {
                "name": "Rainbow Dash",
                "type": "character",
                "group": "Main Cast",
                "group_order": 1
            }
        },
        {
            "id": "8",
            "type": "story_tag",
            "attributes": {
                "name": "Pinkie Pie",
                "type": "character",
                "group": "Main Cast",
                "group_order": 2
            }
        },
        {
            "id": "9",
            "type": "story_tag",
            "attributes": {
                "name": "Applejack",
                "type": "character",
                "group": "Main Cast",
                "group_order": 3
            }
        },
        {
            "id": "10",
            "type": "story_tag",
            "attributes": {
                "name": "Rarity",
                "type": "character",
                "group": "Main Cast",
                "group_order": 4
            }
        },
        {
            "id": "12",
            "type": "story_tag",
            "attributes": {
                "name": "Apple Bloom",
                "type": "character",
                "group": "Cutie Mark Crusaders",
                "group_order": 0
            }
        },
        {
            "id": "13",
            "type": "story_tag",
            "attributes": {
                "name": "Scootaloo",
                "type": "character",
                "group": "Cutie Mark Crusaders",
                "group_order": 1
            }
        },
        {
            "id": "14",
            "type": "story_tag",
            "attributes": {
                "name": "Sweetie Belle",
                "type": "character",
                "group": "Cutie Mark Crusaders",
                "group_order": 2
            }
        },
        {
            "id": "15",
            "type": "story_tag",
            "attributes": {
                "name": "Spike",
                "type": "character",
                "group": "Main Cast",
                "group_order": 6
            }
        },
        {
            "id": "73",
            "type": "story_tag",
            "attributes": {
                "name": "Main 6",
                "type": "character",
                "group": "Main Cast",
                "group_order": 7
            }
        },
        {
            "id": "74",
            "type": "story_tag",
            "attributes": {
                "name": "Cutie Mark Crusaders",
                "type": "character",
                "group": "Cutie Mark Crusaders",
                "group_order": 3
            }
        },
        {
            "id": "83",
            "type": "story_tag",
            "attributes": {
                "name": "Babs Seed",
                "type": "character",
                "group": "Cutie Mark Crusaders",
                "group_order": 4
            }
        }
    ]
}

Lithl avatar Sep 11 '17 20:09 Lithl

With the recent update, the story edit page no longer groups the character tags. However, the new story edit page does note what series a character is tied to, and the API response doesn't have that data.

Lithl avatar Dec 22 '17 22:12 Lithl

Update: Just tested, tag data still does not include what series a character is tied to.

Lithl avatar Jan 28 '20 23:01 Lithl