https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43491 Bug ID: 43491 Summary: REST API XML payload conversion breaks plugin API routes that read XML Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: kyle@bywatersolutions.com QA Contact: tomascohen@gmail.com CC: tomascohen@gmail.com Target Milestone: --- Bug 37762 makes the REST API convert request bodies sent with an application/xml content type to JSON so they can be validated against Koha's swagger definitions, and convert response bodies with an application/xml content type from JSON to XML. Both hooks apply to every route, including the /contrib plugin routes. Plugins define their own API and may consume and produce XML directly. I've been working on a plugin based version of the NCIP server for Koha, with NCIP being entirely XML based. On Koha 26.05 and later the request hook replaces the incoming NCIP message with a JSON rendering of it before the plugin controller runs. The conversion drops element attributes and ordering, so the original message can't be rebuilt from it. In my case it's the attributes that are needed. I have found a workaround by grabbing the raw body from the buffered PSGI input Mojolicious's $c variable. In the other direction, the response hook dies trying to parse the plugin's XML response as JSON, turning it into a 500. This affects Koha 26.05+ -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.