JanBi 0 Posted June 9, 2025 Posted June 9, 2025 I am trying to update Items of my library via emby rest api in Java What is working? Getting a BaseItemDto via "localhost:8096/Users/376be745cbec4706a5282b916f15627d/Items/338" final BaseItemDto response3 = restClient.get() .uri(uriBuilder -> uriBuilder .path("/Users/376be745cbec4706a5282b916f15627d/Items/338") .build()) .retrieve() .body(BaseItemDto.class); logger.info("Response3: {} | {} | {} | {} | {}", response3.getName(), response3.getPath(), response3.getListingsPath(), response3.getId(), response3.getGuid()); What is not working? Updating an attribute of BaseItemDto response3.setName("new_name"); final ResponseEntity<Void> response4 = restClient.post() .uri(uriBuilder -> uriBuilder .path("/Items/338") .build()) .contentType(MediaType.APPLICATION_JSON) .body(response3) .retrieve() .toBodilessEntity(); What is the Exception on the client side? org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: "Value cannot be null. (Parameter 'source')" at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:103) ~[spring-web-6.2.7.jar:6.2.7] at org.springframework.web.client.StatusHandler.lambda$defaultHandler$3(StatusHandler.java:86) ~[spring-web-6.2.7.jar:6.2.7] at org.springframework.web.client.StatusHandler.handle(StatusHandler.java:146) ~[spring-web-6.2.7.jar:6.2.7] at org.springframework.web.client.DefaultRestClient$DefaultResponseSpec.applyStatusHandlers(DefaultRestClient.java:831) ~[spring-web-6.2.7.jar:6.2.7] at org.springframework.web.client.DefaultRestClient$DefaultResponseSpec.lambda$toBodilessEntity$3(DefaultRestClient.java:794) ~[spring-web-6.2.7.jar:6.2.7] at org.springframework.web.client.DefaultRestClient$DefaultRequestBodyUriSpec.exchangeInternal(DefaultRestClient.java:579) ~[spring-web-6.2.7.jar:6.2.7] at org.springframework.web.client.DefaultRestClient$DefaultRequestBodyUriSpec.exchange(DefaultRestClient.java:533) ~[spring-web-6.2.7.jar:6.2.7] at org.springframework.web.client.RestClient$RequestHeadersSpec.exchange(RestClient.java:680) ~[spring-web-6.2.7.jar:6.2.7] at org.springframework.web.client.DefaultRestClient$DefaultResponseSpec.executeAndExtract(DefaultRestClient.java:814) ~[spring-web-6.2.7.jar:6.2.7] at org.springframework.web.client.DefaultRestClient$DefaultResponseSpec.toBodilessEntity(DefaultRestClient.java:792) ~[spring-web-6.2.7.jar:6.2.7] at bi.bodensee.emby.restclient.controller.EmbyController.readItem(EmbyController.java:67) ~[classes/:na] at bi.bodensee.emby.restclient.start.EmbyRestClientApplication.lambda$crawl$1(EmbyRestClientApplication.java:49) ~[classes/:na] at org.springframework.boot.SpringApplication.lambda$callRunner$5(SpringApplication.java:789) ~[spring-boot-3.4.6.jar:3.4.6] at org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:82) ~[spring-core-6.2.7.jar:6.2.7] at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) ~[spring-core-6.2.7.jar:6.2.7] at org.springframework.util.function.ThrowingConsumer$1.accept(ThrowingConsumer.java:86) ~[spring-core-6.2.7.jar:6.2.7] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:797) ~[spring-boot-3.4.6.jar:3.4.6] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:788) ~[spring-boot-3.4.6.jar:3.4.6] at org.springframework.boot.SpringApplication.lambda$callRunners$3(SpringApplication.java:773) ~[spring-boot-3.4.6.jar:3.4.6] at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[na:na] at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) ~[na:na] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) ~[na:na] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na] at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[na:na] at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[na:na] at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na] at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:773) ~[spring-boot-3.4.6.jar:3.4.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) ~[spring-boot-3.4.6.jar:3.4.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1362) ~[spring-boot-3.4.6.jar:3.4.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1351) ~[spring-boot-3.4.6.jar:3.4.6] at bi.bodensee.emby.restclient.start.EmbyRestClientApplication.main(EmbyRestClientApplication.java:31) ~[classes/:na] What does the server log states? 2025-06-09 11:35:13.255 Debug SqliteItemRepository: GetitemById Movie 338 /volume1/homes/mueller/Video/Provider/filename.mp4 2025-06-09 11:35:13.256 Error Server: Error processing request *** Error Report *** Version: 4.8.11.0 Command line: /volume1/@appstore/EmbyServer/system/EmbyServer.dll -programdata /var/packages/EmbyServer/var -ffdetect /var/packages/EmbyServer/target/bin/ffdetect -ffmpeg /var/packages/EmbyServer/target/bin/ffmpeg -ffprobe /var/packages/EmbyServer/target/bin/ffprobe -nolocalportconfig -ignore_vaapi_enabled_flag -pidfile /var/packages/EmbyServer/var/EmbyServer.pid -defaultdirectory /volume1/Public -updatepackage emby-server-synology72_{version}_x86_64.spk -noautorunwebapp Operating system: Linux version 4.4.302+ (root@build5) (gcc version 12.2.0 (GCC) ) #72806 SMP Thu Sep 5 13:44:44 CST 2024 Framework: .NET 6.0.36 OS/Process: x64/x64 Runtime: volume1/@appstore/EmbyServer/system/System.Private.CoreLib.dll Processor count: 2 Data path: /var/packages/EmbyServer/var Application path: /volume1/@appstore/EmbyServer/system System.ArgumentNullException: System.ArgumentNullException: Value cannot be null. (Parameter 'source') at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Emby.Api.ItemUpdateService.UpdateItem(BaseItemDto request, BaseItem item) at Emby.Api.ItemUpdateService.Post(UpdateItem request) at Emby.Server.Implementations.Services.ServiceController.<>c__DisplayClass8_0.<VoidActionDelegate>b__0(Object service, Object request) at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType) at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken) at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken) Source: System.Linq TargetSite: Void ThrowArgumentNullException(System.Linq.ExceptionArgument) 2025-06-09 11:35:13.256 Info Server: http/1.1 Response 400 to host7. Time: 2ms. POST http://host6:8096/Items/338 Which Emby Version is running? Version 4.8.11.0 Synology 7.2 Architecture: 64 Bit NAS Thank you in advance for any advice
JanBi 0 Posted June 9, 2025 Author Posted June 9, 2025 Forget to mention my Header: var factory = new HttpComponentsClientHttpRequestFactory(); factory.setConnectTimeout(10000); factory.setReadTimeout(10000); final RestClient restClient = RestClient.builder() .requestFactory(factory) .baseUrl("http://localhost:8096") .defaultHeader("X-Emby-Token", "b14a2b8489324b9ba19a7e00d2de9b36") .defaultHeader("Authorization", "Emby") .defaultHeader("UserId", "376be745cbec4706a5282b916f15627d") .defaultHeader("Client", "Emby Classic") .defaultHeader("Device", "Windows Notebook") .defaultHeader("DeviceId", "cxyz") .defaultHeader("Version", "1.0.0.0") .build();
softworkz 5066 Posted June 10, 2025 Posted June 10, 2025 Most likely this is because of a missing ProviderIds field in the BaseItemDto JSON. You can try adding "ProviderIds": {}, to the JSON. Or change the item via UI so that it gets a providerid. I'm not sure why the Emby SDK RestAPI: getUsersByUseridItemsById API doesn't return it (even when empty). @Luke ?
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