Handling non 2xx HTTP response statuses in lua RestApi{method} calls

Is there a way to avoid ERROR logs in Orthanc in case a lua RestApiGet (or other methods) call gets a 404 (or other non 2xx) status in the response?

Example:

local stationName = RestApiGet("/instances/" .. instanceId .. "/content/0008-1010")

This will log the following if an instance doesn’t have a 0008,1010 (StationName) tag:

E1028 17:07:21.125818       LUA-EVENTS LuaScripting.cpp:448] Lua: Error in RestApiGet() for URI: /instances/29fd0745-e95ac493-2e2bb7d3-e8d06ad6-9b38c685/content/0008-1010

I’d like to avoid logging that on ERROR level.

Hello,

Yes, you could use a Python plugins instead of a Lua script. Lua is only for simple use cases. If you need more flexibility, switch to Python or Java.

Regards,
Sébastien-

1 Like