Class: Dcm4chee::Api::V1::InstancesController

Inherits:
BaseController show all
Defined in:
app/controllers/dcm4chee/api/v1/instances_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

Restore an instance from the trash.

Examples:

# Request
POST /api/instances HTTP/1.1
Accept: application/vnd.menglifang.org; version=1
Content-Type: application/json

{ "trashed_instance_id": ... }

# Response
HTTP/1.1 201 Created


59
60
61
62
63
64
# File 'app/controllers/dcm4chee/api/v1/instances_controller.rb', line 59

def create
  trashed_instance = TrashedInstance.get!(params[:trashed_instance_id])
  trashed_instance.restore_from_trash

  head :created
end

#indexObject

Search for instances. Supported querying conditions:

series_id     ID of a series

Check DataMapper::Searcher::ClassMethods for supported querying operators.

Examples:

# Request
GET /api/instances?q[series_id]=... HTTP/1.1
Accept: application/vnd.menglifang.org; version=1

# Response
HTTP/1.1 200 OK
{
  "instances": [{
    "id": ...,
    "series_id": ...,
    "created_at": ...,
    "instance_no": ...,
    "sop_cuid": ...,
    "sop_iuid": ...,
    "series_iuid": ...,
    "study_iuid": ...,
    "availability": ...,
    "dcm_elements": [{
      "name": ...,
      "value": ...,
      "tag": ...,
      "value_representation": ...,
      "length": ...
    }, ...]
  }, ...]
}


41
42
43
44
45
# File 'app/controllers/dcm4chee/api/v1/instances_controller.rb', line 41

def index
  instances = Instance.search(params[:q])

  respond_with instances: instances
end