Class: Dcm4chee::Api::V1::TrashedInstancesController

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

Instance Method Summary collapse

Instance Method Details

#createObject

Move a instance to the trash.

Examples:

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

{ "instance_id": ... }

# Response
HTTP/1.1 201 Created


57
58
59
60
61
62
# File 'app/controllers/dcm4chee/api/v1/trashed_instances_controller.rb', line 57

def create
  instance = Instance.get!(params[:instance_id])
  instance.move_to_trash

  head :created
end

#destroyObject

Delete an instance from the trash.

Examples:

# Request
DELETE /api/trashed_instances/... HTTP/1.1
Accept: application/vnd.menglifang.org; version=1

# Response
HTTP/1.1 200 OK


73
74
75
76
77
78
# File 'app/controllers/dcm4chee/api/v1/trashed_instances_controller.rb', line 73

def destroy
  instance = TrashedInstance.get!(params[:id])
  instance.remove_from_trash

  head :ok
end

#indexObject

Search for instances from the trash. Supported querying conditions:

trashed_series_id

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

Examples:

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

# Response
HTTP/1.1 200 OK
{
  "trashed_instances": [{
    "id": ...,
    "trashed_series_id": ...,
    "created_at": ...,
    "sop_iuid": ...,
    "series_iuid": ...,
    "study_iuid": ...,
    "dcm_elements": [{
      "name": ...,
      "value": ...,
      "tag": ...,
      "value_representation": ...,
      "length": ...
    }, ...]
  }, ...]
}


39
40
41
42
43
# File 'app/controllers/dcm4chee/api/v1/trashed_instances_controller.rb', line 39

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

  respond_with trashed_instances: instances
end