Class: Decidim::Api::QueriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/decidim/api/queries_controller.rb

Overview

This controller takes queries from an HTTP endpoint and sends them out to the Schema to be executed, later returning the response as JSON.

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_ability_klass

Instance Method Details

#createObject



10
11
12
13
14
15
# File 'app/controllers/decidim/api/queries_controller.rb', line 10

def create
  query_string = params[:query]
  query_variables = ensure_hash(params[:variables])
  result = Schema.execute(query_string, variables: query_variables, context: context)
  render json: result
end