Uploading the Dicoms
Use the following sample script to upload Dicoms to the service.
import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder
file_paths = ['dicom-file1.dcm', 'dicom-file2.dcm']
m = MultipartEncoder({
    file_path: (file_path, open(file_path, 'rb'), 'application/dicom')
    for file_path in file_paths
})
content_type = 'multipart/related; type=application/dicom; boundary={}'\
.format(m.boundary_value)
# Make the HTTP POST request to the service
r = requests.post(
    url=URL, data=m,
    headers={'Content-Type': content_type,
             'Authorization': 'Token {}'.format(TOKEN)})Uploading Dicoms to the Service
POST http://BASE URL + studies
Use the URL to make a POST call with the multipart encoded payload.
Path Parameters
Name
Type
Description
file_paths*
String
Represents the file location.
URL*
String
The URL pointing to the service.
Headers
Name
Type
Description
Authorization*
String
Bearer token.
Content-Type*
String
Request Body
Name
Type
Description
data*
String
{
    "message": "Success",
    "series_instance_uids": ["SERIES_INSTANCE_UID_1", "SERIES_INSTANCE_UID_2",],
    "detailed_info":[
        {
            "SeriesInstanceUID": "SERIES_INSTANCE_UID 1",
            "NumberOfSeriesRelatedInstances": "INTEGER"
        },
        {
            "SeriesInstanceUID": "SERIES_INSTANCE_UID 2",
            "NumberOfSeriesRelatedInstances": "INTEGER"
        }      
    ]
}{
    "message": "No DICOM files were uploaded!"
}Response Attribute
Attribute
Value type
Description
Sample Value
messageString
It validates the post call action based on the response status code.
"message": "Success"series_instance_uidsInteger
It is a unique identifier given for a series of Dicom images.
"series_instance_uids": [
    "1.2.826.0.1.3680043.8.498.83895378777916398722746509596078492186"detailed_infoString
It is an object which contains a set of Dicom images.
-
NumberOfSeriesRelatedInstancesInteger
It is the number of series instance UID's that belong to a set of series.
"NumberOfSeriesRelatedInstances": 50authenticatedBoolean
It validates the token validity.
"authenticated": falseLast updated
Was this helpful?