Class: Dcm4chee::Api::V1::ApplicationEntitiesController

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

Instance Method Summary collapse

Instance Method Details

#createObject

Create a new application entity

Examples:

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

{
  "application_entity": {
    "title": ...,
    "host": ...,
    "port": ...,
    "cipher_suites": ...,
    "patient_id_issuer": ...,
    "accession_number_issuer": ...,
    "username": ...,
    "password": ...,
    "fs_group": ...,
    "group": ...,
    "description": ...,
    "wado_url": ...,
    "station_name": ...,
    "institution": ...,
    "department": ...,
    "installed": ...
  }
}

# Response
HTTP/1.1 201 Created

{
  "id": ...,
  "title": ...,
  "host": ...,
  "port": ...,
  "cipher_suites": ...,
  "patient_id_issuer": ...,
  "accession_number_issuer": ...,
  "username": ...,
  "password": ...,
  "fs_group": ...,
  "group": ...,
  "description": ...,
  "wado_url": ...,
  "station_name": ...,
  "institution": ...,
  "department": ...,
  "installed": ...
}


96
97
98
99
100
# File 'app/controllers/dcm4chee/api/v1/application_entities_controller.rb', line 96

def create
  entity = Dcm4chee::ApplicationEntity.create_by_service(params[:application_entity])

  render json: entity, status: :created
end

#destroyObject

Delete an application entity

Examples:

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

# Response
HTTP/1.1 200 OK


169
170
171
172
173
174
# File 'app/controllers/dcm4chee/api/v1/application_entities_controller.rb', line 169

def destroy
  entity = Dcm4chee::ApplicationEntity.get!(params[:id])
  entity.destroy_by_service

  head :ok
end

#indexObject

List the application entities

Examples:

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

# Response
HTTP/1.1 200 OK
{
  "application_entities": [{
    "id": ...,
    "title": ...,
    "host": ...,
    "port": ...,
    "cipher_suites": ...,
    "patient_id_issuer": ...,
    "accession_number_issuer": ...,
    "username": ...,
    "password": ...,
    "fs_group": ...,
    "group": ...,
    "description": ...,
    "wado_url": ...,
    "station_name": ...,
    "institution": ...,
    "department": ...,
    "installed": ...,
    "check_host": ...
  }, ...]
}


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

def index
  entities = Dcm4chee::ApplicationEntity.all(order: [:id.desc])

  respond_with application_entities: entities
end

#updateObject

Update an application entity

Examples:

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

{
  "application_entity": {
    "title": ...,
    "host": ...,
    "port": ...,
    "cipher_suites": ...,
    "patient_id_issuer": ...,
    "accession_number_issuer": ...,
    "username": ...,
    "password": ...,
    "fs_group": ...,
    "group": ...,
    "description": ...,
    "wado_url": ...,
    "station_name": ...,
    "institution": ...,
    "department": ...,
    "installed": ...
  }
}

# Response
HTTP/1.1 200 OK

{
  "id": ...,
  "title": ...,
  "host": ...,
  "port": ...,
  "cipher_suites": ...,
  "patient_id_issuer": ...,
  "accession_number_issuer": ...,
  "username": ...,
  "password": ...,
  "fs_group": ...,
  "group": ...,
  "description": ...,
  "wado_url": ...,
  "station_name": ...,
  "institution": ...,
  "department": ...,
  "installed": ...
}


153
154
155
156
157
158
# File 'app/controllers/dcm4chee/api/v1/application_entities_controller.rb', line 153

def update
  entity = Dcm4chee::ApplicationEntity.get!(params[:id])
  entity.update_by_service(params[:application_entity])

  render json: entity, status: :ok
end