How to get http status code from HttpPost ?

Hi everyone,

I want to get the returned status once I make a HttpPost call, how could I do this?

I’ve seen OrthancPluginHttpClient mentioned in the group, but I can’t find any kind of documentation about it - or if it is at all what I should use ?


Here is the link to the documentation of function “OrthancPluginHttpClient()” in the Orthanc SDK:

Check out the “httpStatus” parameter, that will be filled with the HTTP status.

Thanks for your answer.

From what I see this is an api/doc to create plugins, I just want to execute a simple LUA script for the transfer of the dicom into some rest API.
Do I need to develop a full plugin (using the SDK) or is it possible with only LUA?

This is my LUA script :

function OnStoredInstance(instanceId, tags, metadata)
local apiPostURL = os.getenv(“API_POST_URL”)

local dicom = RestApiGet(“/instances/” … instanceId … “/file”)

local headers = {
[‘Authorization’] = ‘Bearer token…’

local answer = HttpPost(apiPostURL, dicom , headers)

if answer ~= ‘ERROR’ then
print(‘Successfully sent dicom, now deleting the file…’)

I just wanted to add some sanity checks (if statusCode === 201) etc…

As of Orthanc 1.5.2, it is not possible to retrieve the HTTP status corresponding to a call to HttpGet(), HttpPost(), HttpPut(), HttpDelete() in Lua scripts. This information is only available in C/C++ plugins.

Please introduce a feature request in our issue tracker if this is of interest to you:


Ok thanks for clarifying !

Hello, I am very interested in this but the link is not working.
It it possible to consider including in a future release?

Thank you

Hi @tgatzoulis ,

I have added the feature in our TODO list for a future release.

Best regards,


1 Like