Jellyfin Forum
SOLVED: Jellyfin not accepting Item Update API call - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: SOLVED: Jellyfin not accepting Item Update API call (/t-solved-jellyfin-not-accepting-item-update-api-call)



Jellyfin not accepting Item Update API call - ram - 2024-09-07

I'm trying to update Names for Items with the Jellyfin API but keep getting 400 errors. Looking through the API docs, I can't find any fields marked as required, though even when I fill what I can, I'm finding myself with this problem.

Here's my python script, stripped down to my fundamental problem:
Code:
import urllib.request
import urllib.parse
import json

headers = {
"Authorization": "MediaBrowser Token=xxxx",
"Content-Type":"application/json",
}

update_url = "http://localhost:8096/Items/0004fcba40a043393e8c671a3b1898e9"

data = {
    "Name":"sure",
}

update_request = urllib.request.Request(url=update_url, method="POST", headers=headers, data=json.dumps(data).encode("utf-8"))

update_response = urllib.request.urlopen(update_request)
print(update_response.read().decode('utf-8'))

Any help is appreciated!


RE: Jellyfin not accepting Item Update API call - ram - 2024-09-07

I altered the payload so it now fills out every field in the post request, but it's still 400 erroring. The payload I'm working with becomes:
Code:
  {
    "Name": "10DA 2.03 - Cold Vengeance",
    "OriginalTitle": null,
    "ServerId": "a58a373aabd54a139ea8abac99421179",
    "Id": "0004fcba40a043393e8c671a3b1898e9",
    "Etag": null,
    "SourceType": null,
    "PlaylistItemId": null,
    "DateCreated": null,
    "DateLastMediaAdded": null,
    "ExtraType": null,
    "AirsBeforeSeasonNumber": null,
    "AirsAfterSeasonNumber": null,
    "AirsBeforeEpisodeNumber": null,
    "CanDelete": null,
    "CanDownload": null,
    "HasLyrics": false,
    "HasSubtitles": null,
    "PreferredMetadataLanguage": null,
    "PreferredMetadataCountryCode": null,
    "Container": null,
    "SortName": null,
    "ForcedSortName": null,
    "Video3DFormat": null,
    "PremiereDate": "2017-01-01T00:00:00.0000000Z",
    "ExternalUrls": null,
    "MediaSources": null,
    "CriticRating": null,
    "ProductionLocations": null,
    "Path": "E:\\Whovian Audio Dramas\\Big Finish - Doctor Who\\2. The New Series\\3. The Tenth Doctor Adventures (10DA)\\2. Series 2\\10DA 2.03 - Cold Vengeance.mp3",
    "EnableMediaSourceDisplay": null,
    "OfficialRating": null,
    "CustomRating": null,
    "ChannelId": null,
    "ChannelName": null,
    "Overview": null,
    "Taglines": null,
    "Genres": null,
    "CommunityRating": null,
    "CumulativeRunTimeTicks": null,
    "RunTimeTicks": 34547983670,
    "PlayAccess": null,
    "AspectRatio": null,
    "ProductionYear": 2017,
    "IsPlaceHolder": null,
    "Number": null,
    "ChannelNumber": null,
    "IndexNumber": 3,
    "IndexNumberEnd": null,
    "ParentIndexNumber": 0,
    "RemoteTrailers": null,
    "ProviderIds": null,
    "IsHD": null,
    "IsFolder": false,
    "ParentId": null,
    "Type": "AudioBook",
    "People": null,
    "Studios": null,
    "GenreItems": null,
    "ParentLogoItemId": null,
    "ParentBackdropItemId": null,
    "ParentBackdropImageTags": null,
    "LocalTrailerCount": null,
    "UserData": {
      "PlaybackPositionTicks": 0,
      "PlayCount": 0,
      "IsFavorite": false,
      "Played": false,
      "Key": "The Tenth Doctor Adventures - Series 2-Cold Vengeance-0000-0003Cold Vengeance"
    },
    "RecursiveItemCount": null,
    "ChildCount": null,
    "SeriesName": null,
    "SeriesId": null,
    "SeasonId": null,
    "SpecialFeatureCount": null,
    "DisplayPreferencesId": null,
    "Status": null,
    "AirTime": null,
    "AirDays": null,
    "Tags": null,
    "PrimaryImageAspectRatio": null,
    "Artists": [
      "Big Finish Productions"
    ],
    "ArtistItems": [
      {
        "Name": "Big Finish Productions",
        "Id": "3abf4f2c4493a07e82c933e3a6c86699"
      }
    ],
    "Album": "Cold Vengeance",
    "CollectionType": null,
    "DisplayOrder": null,
    "AlbumId": null,
    "AlbumPrimaryImageTag": null,
    "SeriesPrimaryImageTag": null,
    "AlbumArtist": "The Tenth Doctor Adventures - Series 2",
    "AlbumArtists": [
      {
        "Name": "The Tenth Doctor Adventures - Series 2",
        "Id": "c76cf6f1df35879bc8a218d3989af2cc"
      }
    ],
    "SeasonName": null,
    "MediaStreams": null,
    "VideoType": null,
    "PartCount": null,
    "MediaSourceCount": null,
    "ImageTags": {
      "Primary": "9532dbbbedc352cc0c18789a5aca6cba"
    },
    "BackdropImageTags": [],
    "ScreenshotImageTags": null,
    "ParentLogoImageTag": null,
    "ParentArtItemId": null,
    "ParentArtImageTag": null,
    "SeriesThumbImageTag": null,
    "ImageBlurHashes": {
      "Primary": {
        "9532dbbbedc352cc0c18789a5aca6cba": "eDDT65xvXl$zIWMxxww}koD%*J%2s9Sg-;H@?aR-nQM_WDWmaLbbt7"
      }
    },
    "SeriesStudio": null,
    "ParentThumbItemId": null,
    "ParentThumbImageTag": null,
    "ParentPrimaryImageItemId": null,
    "ParentPrimaryImageTag": null,
    "Chapters": null,
    "Trickplay": null,
    "LocationType": "FileSystem",
    "IsoType": null,
    "MediaType": "Audio",
    "EndDate": null,
    "LockedFields": null,
    "TrailerCount": null,
    "MovieCount": null,
    "SeriesCount": null,
    "ProgramCount": null,
    "EpisodeCount": null,
    "SongCount": null,
    "AlbumCount": null,
    "ArtistCount": null,
    "MusicVideoCount": null,
    "LockData": null,
    "Width": null,
    "Height": null,
    "CameraMake": null,
    "CameraModel": null,
    "Software": null,
    "ExposureTime": null,
    "FocalLength": null,
    "ImageOrientation": null,
    "Aperture": null,
    "ShutterSpeed": null,
    "Latitude": null,
    "Longitude": null,
    "Altitude": null,
    "IsoSpeedRating": null,
    "SeriesTimerId": null,
    "ProgramId": null,
    "ChannelPrimaryImageTag": null,
    "StartDate": null,
    "CompletionPercentage": null,
    "IsRepeat": null,
    "EpisodeTitle": null,
    "ChannelType": null,
    "Audio": null,
    "IsMovie": null,
    "IsSports": null,
    "IsSeries": null,
    "IsLive": null,
    "IsNews": null,
    "IsKids": null,
    "IsPremiere": null,
    "TimerId": null,
    "NormalizationGain": null,
    "CurrentProgram": null
  }

I also tried on the endpoint /Users/{userId]/Items/{itemId} to a 405 error, presumably because that endpoint's now deprecated as of 9.10?


RE: Jellyfin not accepting Item Update API call - niels - 2024-09-07

You need to fill in all the fields. So normally you first GET the item, change the things you want to change and then POST it.


RE: Jellyfin not accepting Item Update API call - itai shufman - 2024-10-19

i seem to have the same problem and getting the item first isnt solving it.


import requests

auth = 'MediaBrowser Token="my_api_token"'

server = 'http://127.0.0.1:8096'

uri = f"/Items?parentId=some_playlist_id&fields=Path"

videos = requests.get(f'{server}{uri}',headers={'Authorization': auth}).json()

for vid in videos['Items']:
vid['Name'] = custom_parsing_function(vid['Path'])
update_uri = f"/Items/{vid['Id']}"
resp = requests.post(f'{server}{update_uri}',headers={'Authorization': auth}, json=vid)



i get status code 400 back.
is this because i include the "path" in thhe GET command?