mchahn 16 Posted January 25, 2023 Share Posted January 25, 2023 < I apologize for asking api questions over and over but every time I try something new I do something wrong. > I'm trying to modify a record in the DB for the first time. I need to get a season record, update the LastPlayedDate field, and post it back. I'm requesting a season which returns an array of episode items. I'm assuming each array entry is an episode record. Here is the season request and results. ... http://<hostname>:8096/emby/Users/<userid>/Items/?ParentId=4561960&X-Emby-Token=<token> {Items: [ { "Name": "Pilot", "ServerId": "ae3349983dbe45d9aa1d317a7753483e", "Id": "4696734", "RunTimeTicks": 13184140000, "IndexNumber": 1, "ParentIndexNumber": 1, "IsFolder": false, "Type": "Episode", "ParentLogoItemId": "4561949", "ParentBackdropItemId": "4561949", "ParentBackdropImageTags": [ "786971cdc9919551425f498a1ead8783" ], "UserData": { "PlaybackPositionTicks": 0, "PlayCount": 1, "IsFavorite": false, "LastPlayedDate": "2023-01-25T00:02:37.779Z", "Played": true }, "SeriesName": "Abbott Elementary", "SeriesId": "4561949", "SeasonId": "4561960", "SeriesPrimaryImageTag": "894e368f93870dc80e407f7b06f130bc", "SeasonName": "Season 1", "ImageTags": { "Primary": "be6f958aabf8e60740600c544c7877a2" }, "BackdropImageTags": [], "ParentLogoImageTag": "48461820ad1d9e3c9b1a522b2d9fe9f8", "MediaType": "Video" }, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…} ], TotalRecordCount:13} Now I take this record and update LastPlayedDate to the current date "2023-01-25T00:34:59.505Z". Then I try to post it. The payload is the json version of the modified record. You can see I'm getting a 404. Can anyone tell me what I'm doing wrong? Request URL: http://<hostname>:8096/emby/Users/<user id>/Items/?Id=4696734&X-Emby-Token=<token> Request Method: POST Status Code: 404 Not Found Remote Address: 192.168.1.103:8096 Referrer Policy: strict-origin-when-cross-origin Link to comment Share on other sites More sharing options...
Happy2Play 8239 Posted January 25, 2023 Share Posted January 25, 2023 Doesn't look like you are using the correct endpoint as there is no Post in /Users/{UserId}/Items. PlaystateService 2 Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 25, 2023 Author Share Posted January 25, 2023 I have used "/Items?Id=<id>" for all my GETs so I assumed it would work here with a POST payload of the entire record. I tried the format you show, "/Items/<id>/UserData" and this worked. It also has the advantage of only having to POST the UserData instead of the whole record. So thanks. I'll get in the habit of using "/Items/Id" everywhere now. P.S. How did you get swagger to work? It has never worked for me. I get the error: "Fetch error, Possible mixed-content issue? ... ". There was a thread here some time ago about this problem and it was concluded that the problem was insurmountable. Can you please tell me what browser URL you used and what you put in the Explore text box at the top of the page? Link to comment Share on other sites More sharing options...
Happy2Play 8239 Posted January 25, 2023 Share Posted January 25, 2023 1 hour ago, mchahn said: How did you get swagger to work? It has never worked for me. I get the error: "Fetch error, Possible mixed-content issue? ... ". That is the browser CORS issue, you can add localIP:port url to the browser flags. Otherwise requires localhost or https connection. 1 Link to comment Share on other sites More sharing options...
Cheesegeezer 3086 Posted January 25, 2023 Share Posted January 25, 2023 3 hours ago, mchahn said: I have used "/Items?Id=<id>" for all my GETs so I assumed it would work here with a POST payload of the entire record. I tried the format you show, "/Items/<id>/UserData" and this worked. It also has the advantage of only having to POST the UserData instead of the whole record. So thanks. I'll get in the habit of using "/Items/Id" everywhere now. P.S. How did you get swagger to work? It has never worked for me. I get the error: "Fetch error, Possible mixed-content issue? ... ". There was a thread here some time ago about this problem and it was concluded that the problem was insurmountable. Can you please tell me what browser URL you used and what you put in the Explore text box at the top of the page? Just make sure you retrieve all the UserData for the item, alter what you need and post back all the UseData. Otherwise it will put null values back. 1 Link to comment Share on other sites More sharing options...
mchahn 16 Posted January 28, 2023 Author Share Posted January 28, 2023 Weird fyi: I needed this PlayedDate field update in order to fix a problem where the next-up feature would show the episode after the last-watched episode instead of showing an earlier unwatched episode. (Phew, that was a long sentence). This "bug" fix has been requested in several threads including one I started recently (that thread has replies blocked so I can't post this comment there). Apparently that has been fixed recently! Next-up now appears to show the oldest unwatched episode. That means I didn't really need to start this thread. I'm surprised no one told me in the other thread this was fixed. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now