[Bug]: "Library Item" schema returned by "Get a Library's Items" endpoint response is different from API docs #1655

Closed
opened 2026-04-24 23:53:20 +02:00 by adam · 2 comments
Owner

Originally created by @funkey7dan on GitHub (Jan 11, 2024).

Describe the issue

The "libraryFiles" attribute is expected in each item in the 'results' attribute array returned from "Get a Library's Items" endpoint, but it's missing.
I also checked to see if maybe the results were minified, but they are not.

P.S
I'm trying to search all my library audio files (relPath) to find the id of a corresponding book, if there is an easier way than trying to iterate over all of the item like i'm attempting, i'll be glad to hear.

Steps to reproduce the issue

python code used to test:

r = requests.Session()
r.headers.update({"Authorization": f"Bearer {TOKEN}"})

def try_to_get_lib_files():
    out = r.get(f"{ABS_PATH}/api/libraries")
    if out.status_code == 200:
        lib_arr = json.loads(out.text)["libraries"]
        for lib in lib_arr:
            """
            Get a Library's Items
            This endpoint returns a library's items, optionally sorted and/or filtered.

            GET https://abs.example.com/api/libraries/<ID>/items

            Expected Response:
            results: Array of Library Item
            """
            out = r.get(
                f"{ABS_PATH}/api/libraries/{lib['id']}/items",
            )
            if out.status_code == 200:
                res = json.loads(out.text)
                item_arr = res["results"]
                """
                Expected: each item in item_arr should contain a libraryFiles attribute - 
                libraryFiles : Array of Library File
                
                Actual: item does not contain a libraryFiles attribute
                """
                if any("libraryFiles" in x for x in item_arr):
                    print("libraryFiles found")
                else:
                    print("libraryFiles not found")
                print(f"minified Attribute status: {res['minified']}")

Audiobookshelf version

v2.7.1

How are you running audiobookshelf?

Docker

Originally created by @funkey7dan on GitHub (Jan 11, 2024). ### Describe the issue The "libraryFiles" attribute is expected in each item in the 'results' attribute array returned from "Get a Library's Items" endpoint, but it's missing. I also checked to see if maybe the results were minified, but they are not. P.S I'm trying to search all my library audio files (relPath) to find the id of a corresponding book, if there is an easier way than trying to iterate over all of the item like i'm attempting, i'll be glad to hear. ### Steps to reproduce the issue python code used to test: ``` r = requests.Session() r.headers.update({"Authorization": f"Bearer {TOKEN}"}) def try_to_get_lib_files(): out = r.get(f"{ABS_PATH}/api/libraries") if out.status_code == 200: lib_arr = json.loads(out.text)["libraries"] for lib in lib_arr: """ Get a Library's Items This endpoint returns a library's items, optionally sorted and/or filtered. GET https://abs.example.com/api/libraries/<ID>/items Expected Response: results: Array of Library Item """ out = r.get( f"{ABS_PATH}/api/libraries/{lib['id']}/items", ) if out.status_code == 200: res = json.loads(out.text) item_arr = res["results"] """ Expected: each item in item_arr should contain a libraryFiles attribute - libraryFiles : Array of Library File Actual: item does not contain a libraryFiles attribute """ if any("libraryFiles" in x for x in item_arr): print("libraryFiles found") else: print("libraryFiles not found") print(f"minified Attribute status: {res['minified']}") ``` ### Audiobookshelf version v2.7.1 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:53:20 +02:00
adam closed this issue 2026-04-24 23:53:20 +02:00
Author
Owner

@advplyr commented on GitHub (Jan 11, 2024):

This is a duplicate of #2123. I never added the expanded items back in after the database update.
You could use the search endpoint to find items.

@advplyr commented on GitHub (Jan 11, 2024): This is a duplicate of #2123. I never added the expanded items back in after the database update. You could use the search endpoint to find items.
Author
Owner

@advplyr commented on GitHub (Jan 11, 2024):

Duplicate of #2123

@advplyr commented on GitHub (Jan 11, 2024): Duplicate of #2123
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1655