EHRbase: 400 error, but OPT still gets saved?

Using the endpoint POST /template/adl1.4, I’m getting a 400: BAD REQUEST (Requested operational template type not supported error. The weird thing is that the OPT still gets saved, and looks fine when using the GET /template/adl1.4 or GET /template/adl1.4/{template_id} endpoints.

Is this a known quirk, or am I doing something wrong in a weird way? :sweat_smile:

Hey @siljelb, Is this the case for any template and can you provide the EHRbase version? Sounds a bit strange, indeed…

1 Like

It’s a bit weird, it happens when running the request through axios, but not when I tried using postman just now. I’ve also tried using Swagger, but it looks like that’s locked into specifying the body as application/json so it doesn’t work for OPTs. And I’ve only tried two different templates, but it happened with both of them.

The EHRbase version was ehrbase/ehrbase:next downloaded on May 17th. Would it be worth trying to upgrade to 2.3?

@siljelb it would be great if you could provide one of the OPTs as an example to look into what is happening.
Also, could you pull and test with ehrbase/ehrbase:2.2.0?

1 Like

Of course, here’s the test template I created to try to rule out my other template being weird: test_ehrbase.opt (47.9 KB)

I’ve tested with v2.2.0, and it looks like it’s exactly the same: my web app gets 400 but Postman gets 201, while the templates actually get saved to the server from both. I’ve been wondering whether I’m doing something wrong with the request or headers, but I can’t think of what:

Method: "POST"
URL: "http://docker-dev:8080/ehrbase/rest/openehr/v1/definition/template/adl1.4"
Accept: "application/json, application/xml"
Content-Type: "application/xml"
Prefer: "return=representation"
1 Like

Thank you @siljelb. This seems to be an older issue. We will check

1 Like