Orthanc Plugin SDK
Documentation of the plugin interface of Orthanc
Classes | Typedefs | Enumerations | Functions
C Interface

The C interface to create Orthanc plugins. More...

Classes

struct  OrthancPluginHttpRequest
 The parameters of a REST request. More...
 
struct  OrthancPluginMemoryBuffer
 A memory buffer allocated by the core system of Orthanc. More...
 

Typedefs

typedef struct
_OrthancPluginRestOutput_t 
OrthancPluginRestOutput
 Opaque structure that represents the HTTP connection to the client application.
 
typedef struct
_OrthancPluginDicomInstance_t 
OrthancPluginDicomInstance
 Opaque structure that represents a DICOM instance received by Orthanc.
 
typedef int32_t(* OrthancPluginRestCallback )(OrthancPluginRestOutput *output, const char *url, const OrthancPluginHttpRequest *request)
 Signature of a callback function that answers to a REST request.
 
typedef int32_t(* OrthancPluginOnStoredInstanceCallback )(OrthancPluginDicomInstance *instance, const char *instanceId)
 Signature of a callback function that is triggered when Orthanc receives a DICOM instance.
 
typedef void(* OrthancPluginFree )(void *buffer)
 Signature of a function to free dynamic memory.
 
typedef int32_t(* OrthancPluginStorageCreate )(const char *uuid, const void *content, int64_t size, OrthancPluginContentType type)
 Callback for writing to the storage area. More...
 
typedef int32_t(* OrthancPluginStorageRead )(void **content, int64_t *size, const char *uuid, OrthancPluginContentType type)
 Callback for reading from the storage area. More...
 
typedef int32_t(* OrthancPluginStorageRemove )(const char *uuid, OrthancPluginContentType type)
 Callback for removing a file from the storage area. More...
 
typedef struct
_OrthancPluginContext_t 
OrthancPluginContext
 Opaque structure that contains information about the Orthanc core.
 

Enumerations

enum  OrthancPluginHttpMethod {
  OrthancPluginHttpMethod_Get,
  OrthancPluginHttpMethod_Post,
  OrthancPluginHttpMethod_Put,
  OrthancPluginHttpMethod_Delete
}
 
enum  OrthancPluginPixelFormat {
  OrthancPluginPixelFormat_Grayscale8,
  OrthancPluginPixelFormat_Grayscale16,
  OrthancPluginPixelFormat_SignedGrayscale16,
  OrthancPluginPixelFormat_RGB24,
  OrthancPluginPixelFormat_RGBA32
}
 
enum  OrthancPluginContentType {
  OrthancPluginContentType_Unknown,
  OrthancPluginContentType_Dicom,
  OrthancPluginContentType_DicomAsJson
}
 

Functions

void OrthancPluginFreeString (OrthancPluginContext *context, char *str)
 Free a string. More...
 
int OrthancPluginCheckVersion (OrthancPluginContext *context)
 Check the compatibility of the plugin wrt. the version of its hosting Orthanc. More...
 
void OrthancPluginFreeMemoryBuffer (OrthancPluginContext *context, OrthancPluginMemoryBuffer *buffer)
 Free a memory buffer. More...
 
void OrthancPluginLogError (OrthancPluginContext *context, const char *message)
 Log an error. More...
 
void OrthancPluginLogWarning (OrthancPluginContext *context, const char *message)
 Log a warning. More...
 
void OrthancPluginLogInfo (OrthancPluginContext *context, const char *message)
 Log an information. More...
 
void OrthancPluginRegisterRestCallback (OrthancPluginContext *context, const char *pathRegularExpression, OrthancPluginRestCallback callback)
 Register a REST callback. More...
 
void OrthancPluginRegisterOnStoredInstanceCallback (OrthancPluginContext *context, OrthancPluginOnStoredInstanceCallback callback)
 Register a callback for received instances. More...
 
void OrthancPluginAnswerBuffer (OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *answer, uint32_t answerSize, const char *mimeType)
 Answer to a REST request. More...
 
void OrthancPluginCompressAndAnswerPngImage (OrthancPluginContext *context, OrthancPluginRestOutput *output, OrthancPluginPixelFormat format, uint32_t width, uint32_t height, uint32_t pitch, const void *buffer)
 Answer to a REST request with a PNG image. More...
 
int OrthancPluginGetDicomForInstance (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *instanceId)
 Retrieve a DICOM instance using its Orthanc identifier. More...
 
int OrthancPluginRestApiGet (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri)
 Make a GET call to the built-in Orthanc REST API. More...
 
int OrthancPluginRestApiPost (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const char *body, uint32_t bodySize)
 Make a POST call to the built-in Orthanc REST API. More...
 
int OrthancPluginRestApiDelete (OrthancPluginContext *context, const char *uri)
 Make a DELETE call to the built-in Orthanc REST API. More...
 
int OrthancPluginRestApiPut (OrthancPluginContext *context, OrthancPluginMemoryBuffer *target, const char *uri, const char *body, uint32_t bodySize)
 Make a PUT call to the built-in Orthanc REST API. More...
 
void OrthancPluginRedirect (OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *redirection)
 Redirect a REST request. More...
 
char * OrthancPluginLookupPatient (OrthancPluginContext *context, const char *patientID)
 Look for a patient. More...
 
char * OrthancPluginLookupStudy (OrthancPluginContext *context, const char *studyUID)
 Look for a study. More...
 
char * OrthancPluginLookupStudyWithAccessionNumber (OrthancPluginContext *context, const char *accessionNumber)
 Look for a study, using the accession number. More...
 
char * OrthancPluginLookupSeries (OrthancPluginContext *context, const char *seriesUID)
 Look for a series. More...
 
char * OrthancPluginLookupInstance (OrthancPluginContext *context, const char *sopInstanceUID)
 Look for an instance. More...
 
void OrthancPluginSendHttpStatusCode (OrthancPluginContext *context, OrthancPluginRestOutput *output, uint16_t status)
 Send a HTTP status code. More...
 
void OrthancPluginSendUnauthorized (OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *realm)
 Signal that a REST request is not authorized. More...
 
void OrthancPluginSendMethodNotAllowed (OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *allowedMethods)
 Signal that this URI does not support this HTTP method. More...
 
void OrthancPluginSetCookie (OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *cookie, const char *value)
 Set a cookie. More...
 
void OrthancPluginSetHttpHeader (OrthancPluginContext *context, OrthancPluginRestOutput *output, const char *key, const char *value)
 Set some HTTP header. More...
 
const char * OrthancPluginGetInstanceRemoteAet (OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
 Get the AET of a DICOM instance. More...
 
int64_t OrthancPluginGetInstanceSize (OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
 Get the size of a DICOM file. More...
 
const char * OrthancPluginGetInstanceData (OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
 Get the data of a DICOM file. More...
 
char * OrthancPluginGetInstanceJson (OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
 Get the DICOM tag hierarchy as a JSON file. More...
 
char * OrthancPluginGetInstanceSimplifiedJson (OrthancPluginContext *context, OrthancPluginDicomInstance *instance)
 Get the DICOM tag hierarchy as a JSON file (with simplification). More...
 
int OrthancPluginHasInstanceMetadata (OrthancPluginContext *context, OrthancPluginDicomInstance *instance, const char *metadata)
 Check whether a DICOM instance is associated with some metadata. More...
 
const char * OrthancPluginGetInstanceMetadata (OrthancPluginContext *context, OrthancPluginDicomInstance *instance, const char *metadata)
 Get the value of some metadata associated with a given DICOM instance. More...
 
void OrthancPluginRegisterStorageArea (OrthancPluginContext *context, OrthancPluginStorageCreate create, OrthancPluginStorageRead read, OrthancPluginStorageRemove remove)
 Register a custom storage area. More...
 
char * OrthancPluginGetOrthancPath (OrthancPluginContext *context)
 Return the path to the Orthanc executable. More...
 
char * OrthancPluginGetOrthancDirectory (OrthancPluginContext *context)
 Return the directory containing the Orthanc. More...
 
char * OrthancPluginGetConfigurationPath (OrthancPluginContext *context)
 Return the path to the configuration file. More...
 

Detailed Description

These functions must be used to create C plugins for Orthanc.

Typedef Documentation

typedef int32_t(* OrthancPluginStorageCreate)(const char *uuid, const void *content, int64_t size, OrthancPluginContentType type)

Signature of a callback function that is triggered when Orthanc writes a file to the storage area.

Parameters
uuidThe UUID of the file.
contentThe content of the file.
sizeThe size of the file.
typeThe content type corresponding to this file.
Returns
0 if success, other value if error.
typedef int32_t(* OrthancPluginStorageRead)(void **content, int64_t *size, const char *uuid, OrthancPluginContentType type)

Signature of a callback function that is triggered when Orthanc reads a file from the storage area.

Parameters
contentThe content of the file (output).
sizeThe size of the file (output).
uuidThe UUID of the file of interest.
typeThe content type corresponding to this file.
Returns
0 if success, other value if error.
typedef int32_t(* OrthancPluginStorageRemove)(const char *uuid, OrthancPluginContentType type)

Signature of a callback function that is triggered when Orthanc deletes a file from the storage area.

Parameters
uuidThe UUID of the file to be removed.
typeThe content type corresponding to this file.
Returns
0 if success, other value if error.

Enumeration Type Documentation

The content types that are supported by Orthanc plugins.

Enumerator
OrthancPluginContentType_Unknown 

Unknown content type

OrthancPluginContentType_Dicom 

DICOM

OrthancPluginContentType_DicomAsJson 

JSON summary of a DICOM file

The various HTTP methods for a REST call.

Enumerator
OrthancPluginHttpMethod_Get 

GET request

OrthancPluginHttpMethod_Post 

POST request

OrthancPluginHttpMethod_Put 

PUT request

OrthancPluginHttpMethod_Delete 

DELETE request

The memory layout of the pixels of an image.

Enumerator
OrthancPluginPixelFormat_Grayscale8 

Graylevel 8bpp image.

The image is graylevel. Each pixel is unsigned and stored in one byte.

OrthancPluginPixelFormat_Grayscale16 

Graylevel, unsigned 16bpp image.

The image is graylevel. Each pixel is unsigned and stored in two bytes.

OrthancPluginPixelFormat_SignedGrayscale16 

Graylevel, signed 16bpp image.

The image is graylevel. Each pixel is signed and stored in two bytes.

OrthancPluginPixelFormat_RGB24 

Color image in RGB24 format.

This format describes a color image. The pixels are stored in 3 consecutive bytes. The memory layout is RGB.

OrthancPluginPixelFormat_RGBA32 

Color image in RGBA32 format.

This format describes a color image. The pixels are stored in 4 consecutive bytes. The memory layout is RGBA.

Function Documentation

void OrthancPluginAnswerBuffer ( OrthancPluginContext context,
OrthancPluginRestOutput output,
const char *  answer,
uint32_t  answerSize,
const char *  mimeType 
)

This function answers to a REST request with the content of a memory buffer.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
outputThe HTTP connection to the client application.
answerPointer to the memory buffer containing the answer.
answerSizeNumber of bytes of the answer.
mimeTypeThe MIME type of the answer.
int OrthancPluginCheckVersion ( OrthancPluginContext context)

This function checks whether the version of this C header is compatible with the current version of Orthanc. The result of this function should always be checked in the OrthancPluginInitialize() entry point of the plugin.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
Returns
1 if and only if the versions are compatible. If the result is 0, the initialization of the plugin should fail.
void OrthancPluginCompressAndAnswerPngImage ( OrthancPluginContext context,
OrthancPluginRestOutput output,
OrthancPluginPixelFormat  format,
uint32_t  width,
uint32_t  height,
uint32_t  pitch,
const void *  buffer 
)

This function answers to a REST request with a PNG image. The parameters of this function describe a memory buffer that contains an uncompressed image. The image will be automatically compressed as a PNG image by the core system of Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
outputThe HTTP connection to the client application.
formatThe memory layout of the uncompressed image.
widthThe width of the image.
heightThe height of the image.
pitchThe pitch of the image (i.e. the number of bytes between 2 successive lines of the image in the memory buffer.
bufferThe memory buffer containing the uncompressed image.
void OrthancPluginFreeMemoryBuffer ( OrthancPluginContext context,
OrthancPluginMemoryBuffer buffer 
)

Free a memory buffer that was allocated by the core system of Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
bufferThe memory buffer to release.
void OrthancPluginFreeString ( OrthancPluginContext context,
char *  str 
)

Free a string that was allocated by the core system of Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
strThe string to be freed.
char* OrthancPluginGetConfigurationPath ( OrthancPluginContext context)

This function returns the path to the configuration file that was specified when starting Orthanc.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
Returns
NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().
int OrthancPluginGetDicomForInstance ( OrthancPluginContext context,
OrthancPluginMemoryBuffer target,
const char *  instanceId 
)

Retrieve a DICOM instance using its Orthanc identifier. The DICOM file is stored into a newly allocated memory buffer.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer.
instanceIdThe Orthanc identifier of the DICOM instance of interest.
Returns
0 if success, other value if error.
const char* OrthancPluginGetInstanceData ( OrthancPluginContext context,
OrthancPluginDicomInstance instance 
)

This function returns a pointer to the content of the given DICOM instance.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
instanceThe instance of interest.
Returns
The pointer to the DICOM data, NULL in case of error.
char* OrthancPluginGetInstanceJson ( OrthancPluginContext context,
OrthancPluginDicomInstance instance 
)

This function returns a pointer to a newly created string containing a JSON file. This JSON file encodes the tag hierarchy of the given DICOM instance.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
instanceThe instance of interest.
Returns
The NULL value in case of error, or a string containing the JSON file. This string must be freed by OrthancPluginFreeString().
const char* OrthancPluginGetInstanceMetadata ( OrthancPluginContext context,
OrthancPluginDicomInstance instance,
const char *  metadata 
)

This functions returns the value of some metadata that is associated with the DICOM instance of interest. Before calling this function, the existence of the metadata must have been checked with OrthancPluginHasInstanceMetadata().

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
instanceThe instance of interest.
metadataThe metadata of interest.
Returns
The metadata value if success, NULL if error.
const char* OrthancPluginGetInstanceRemoteAet ( OrthancPluginContext context,
OrthancPluginDicomInstance instance 
)

This function returns the Application Entity Title (AET) of the DICOM modality from which a DICOM instance originates.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
instanceThe instance of interest.
Returns
The AET if success, NULL if error.
char* OrthancPluginGetInstanceSimplifiedJson ( OrthancPluginContext context,
OrthancPluginDicomInstance instance 
)

This function returns a pointer to a newly created string containing a JSON file. This JSON file encodes the tag hierarchy of the given DICOM instance. In contrast with OrthancPluginGetInstanceJson(), the returned JSON file is in its simplified version.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
instanceThe instance of interest.
Returns
The NULL value in case of error, or a string containing the JSON file. This string must be freed by OrthancPluginFreeString().
int64_t OrthancPluginGetInstanceSize ( OrthancPluginContext context,
OrthancPluginDicomInstance instance 
)

This function returns the number of bytes of the given DICOM instance.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
instanceThe instance of interest.
Returns
The size of the file, -1 in case of error.
char* OrthancPluginGetOrthancDirectory ( OrthancPluginContext context)

This function returns the path to the directory containing the Orthanc executable.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
Returns
NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().
char* OrthancPluginGetOrthancPath ( OrthancPluginContext context)

This function returns the path to the Orthanc executable.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
Returns
NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().
int OrthancPluginHasInstanceMetadata ( OrthancPluginContext context,
OrthancPluginDicomInstance instance,
const char *  metadata 
)

This function checks whether the DICOM instance of interest is associated with some metadata. As of Orthanc 0.8.1, in the callbacks registered by OrthancPluginRegisterOnStoredInstanceCallback(), the only possibly available metadata are "ReceptionDate", "RemoteAET" and "IndexInSeries".

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
instanceThe instance of interest.
metadataThe metadata of interest.
Returns
1 if the metadata is present, 0 if it is absent, -1 in case of error.
void OrthancPluginLogError ( OrthancPluginContext context,
const char *  message 
)

Log an error message using the Orthanc logging system.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
messageThe message to be logged.
void OrthancPluginLogInfo ( OrthancPluginContext context,
const char *  message 
)

Log an information message using the Orthanc logging system.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
messageThe message to be logged.
void OrthancPluginLogWarning ( OrthancPluginContext context,
const char *  message 
)

Log a warning message using the Orthanc logging system.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
messageThe message to be logged.
char* OrthancPluginLookupInstance ( OrthancPluginContext context,
const char *  sopInstanceUID 
)

Look for an instance stored in Orthanc, using its SOP Instance UID tag (0x0008, 0x0018). This function uses the database index to run as fast as possible (it does not loop over all the stored instances).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
sopInstanceUIDThe SOP Instance UID of interest.
Returns
The NULL value if the instance is non-existent, or a string containing the Orthanc ID of the instance. This string must be freed by OrthancPluginFreeString().
char* OrthancPluginLookupPatient ( OrthancPluginContext context,
const char *  patientID 
)

Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020). This function uses the database index to run as fast as possible (it does not loop over all the stored patients).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
patientIDThe Patient ID of interest.
Returns
The NULL value if the patient is non-existent, or a string containing the Orthanc ID of the patient. This string must be freed by OrthancPluginFreeString().
char* OrthancPluginLookupSeries ( OrthancPluginContext context,
const char *  seriesUID 
)

Look for a series stored in Orthanc, using its Series Instance UID tag (0x0020, 0x000e). This function uses the database index to run as fast as possible (it does not loop over all the stored series).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
seriesUIDThe Series Instance UID of interest.
Returns
The NULL value if the series is non-existent, or a string containing the Orthanc ID of the series. This string must be freed by OrthancPluginFreeString().
char* OrthancPluginLookupStudy ( OrthancPluginContext context,
const char *  studyUID 
)

Look for a study stored in Orthanc, using its Study Instance UID tag (0x0020, 0x000d). This function uses the database index to run as fast as possible (it does not loop over all the stored studies).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
studyUIDThe Study Instance UID of interest.
Returns
The NULL value if the study is non-existent, or a string containing the Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
char* OrthancPluginLookupStudyWithAccessionNumber ( OrthancPluginContext context,
const char *  accessionNumber 
)

Look for a study stored in Orthanc, using its Accession Number tag (0x0008, 0x0050). This function uses the database index to run as fast as possible (it does not loop over all the stored studies).

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
accessionNumberThe Accession Number of interest.
Returns
The NULL value if the study is non-existent, or a string containing the Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
void OrthancPluginRedirect ( OrthancPluginContext context,
OrthancPluginRestOutput output,
const char *  redirection 
)

This function answers to a REST request by redirecting the user to another URI using HTTP status 301.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
outputThe HTTP connection to the client application.
redirectionWhere to redirect.
void OrthancPluginRegisterOnStoredInstanceCallback ( OrthancPluginContext context,
OrthancPluginOnStoredInstanceCallback  callback 
)

This function registers a callback function that is called whenever a new DICOM instance is stored into the Orthanc core.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
callbackThe callback function.
void OrthancPluginRegisterRestCallback ( OrthancPluginContext context,
const char *  pathRegularExpression,
OrthancPluginRestCallback  callback 
)

This function registers a REST callback against a regular expression for a URI. This function must be called during the initialization of the plugin, i.e. inside the OrthancPluginInitialize() public function.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
pathRegularExpressionRegular expression for the URI. May contain groups.
callbackThe callback function to handle the REST call.
void OrthancPluginRegisterStorageArea ( OrthancPluginContext context,
OrthancPluginStorageCreate  create,
OrthancPluginStorageRead  read,
OrthancPluginStorageRemove  remove 
)

This function registers a custom storage area, to replace the built-in way Orthanc stores its files on the filesystem. This function must be called during the initialization of the plugin, i.e. inside the OrthancPluginInitialize() public function.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
createThe callback function to store a file on the custom storage area.
readThe callback function to read a file from the custom storage area.
removeThe callback function to remove a file from the custom storage area.
int OrthancPluginRestApiDelete ( OrthancPluginContext context,
const char *  uri 
)

Make a DELETE call to the built-in Orthanc REST API.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
uriThe URI to delete in the built-in Orthanc API.
Returns
0 if success, other value if error.
int OrthancPluginRestApiGet ( OrthancPluginContext context,
OrthancPluginMemoryBuffer target,
const char *  uri 
)

Make a GET call to the built-in Orthanc REST API. The result to the query is stored into a newly allocated memory buffer.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer.
uriThe URI in the built-in Orthanc API.
Returns
0 if success, other value if error.
int OrthancPluginRestApiPost ( OrthancPluginContext context,
OrthancPluginMemoryBuffer target,
const char *  uri,
const char *  body,
uint32_t  bodySize 
)

Make a POST call to the built-in Orthanc REST API. The result to the query is stored into a newly allocated memory buffer.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer.
uriThe URI in the built-in Orthanc API.
bodyThe body of the POST request.
bodySizeThe size of the body.
Returns
0 if success, other value if error.
int OrthancPluginRestApiPut ( OrthancPluginContext context,
OrthancPluginMemoryBuffer target,
const char *  uri,
const char *  body,
uint32_t  bodySize 
)

Make a PUT call to the built-in Orthanc REST API. The result to the query is stored into a newly allocated memory buffer.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
targetThe target memory buffer.
uriThe URI in the built-in Orthanc API.
bodyThe body of the PUT request.
bodySizeThe size of the body.
Returns
0 if success, other value if error.
void OrthancPluginSendHttpStatusCode ( OrthancPluginContext context,
OrthancPluginRestOutput output,
uint16_t  status 
)

This function answers to a REST request by sending a HTTP status code (such as "400 - Bad Request"). Note that:

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
outputThe HTTP connection to the client application.
statusThe HTTP status code to be sent.
void OrthancPluginSendMethodNotAllowed ( OrthancPluginContext context,
OrthancPluginRestOutput output,
const char *  allowedMethods 
)

This function answers to a REST request by signaling that the queried URI does not support this method.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
outputThe HTTP connection to the client application.
allowedMethodsThe allowed methods for this URI (e.g. "GET,POST" after a PUT or a POST request).
void OrthancPluginSendUnauthorized ( OrthancPluginContext context,
OrthancPluginRestOutput output,
const char *  realm 
)

This function answers to a REST request by signaling that it is not authorized.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
outputThe HTTP connection to the client application.
realmThe realm for the authorization process.
void OrthancPluginSetCookie ( OrthancPluginContext context,
OrthancPluginRestOutput output,
const char *  cookie,
const char *  value 
)

This function sets a cookie in the HTTP client.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
outputThe HTTP connection to the client application.
cookieThe cookie to be set.
valueThe value of the cookie.
void OrthancPluginSetHttpHeader ( OrthancPluginContext context,
OrthancPluginRestOutput output,
const char *  key,
const char *  value 
)

This function sets a HTTP header in the HTTP answer.

Parameters
contextThe Orthanc plugin context, as received by OrthancPluginInitialize().
outputThe HTTP connection to the client application.
keyThe HTTP header to be set.
valueThe value of the HTTP header.