About Query Workflows

This section explains how you call the SDK methods to create and run queries with or without parameters against universes.

Simple Query Workflow
  1. Create the query and send it to the server using POST .../query.
  2. Run the query using GET .../data.svc.
  3. Retrieve the query results using GET .../data.svc/{flowName}.

The GET .../data.svc request actually runs the query on the query engine, accesses the data source, and keeps the result set in memory. Consequently, any further GET call retrieves the cached data without running the query again.

Workflow for a Query With Contexts or Prompts
  1. Create the query and send it to the server using POST .../query.
  2. Get the query parameters that need to be responded using GET .../parameters.
  3. Respond to all of the parameters using PUT .../parameters.
    1. If all parameters have been answered and the query can be run, then a successful message is returned.
    2. If not, the PUT call returns the parameters that remain to be answered. Then, repeat PUT .../parameters until all of the parameters get answers and a success status is returned.
  4. Run the query with the answered parameters using GET .../data.svc.
  5. Retrieve the query results using GET .../data.svc/{flowName}.
Remember The query execution returns an error message if not all of the parameters have been answered.
Workflow for a Query With Different Parameter Values

You can run the same query mutiple times with different values for contexts or parameters to get different result sets.

  1. Create the query and send it to the server using POST .../query.
  2. Get the query parameters that need to be responded using GET .../parameters.
  3. Respond to all of the parameters using PUT .../parameters until all of them have been answered. Repeat the call if necessary.
  4. Run the query with the answered parameters using GET .../data.svc.
  5. Retrieve the query results using GET .../data.svc/{flowName}.
  6. Get the query parameters that need to be responded using GET .../parameters.
    Note Skip this step if the parameters have been kept in memory.
  7. Respond to all of the parameters with new values using PUT .../parameters until all of them have been answered. Repeat the call if necessary.
  8. Run the query with the parameters answered in the previous step using GET .../data.svc.
  9. Retrieve the query results using GET .../data.svc/{flowName}.

On step 4, the query is run and the result set is saved in memory. On step 5, the data is returned from the cache. On step 7, the call to PUT .../parameters resets the cache. Some parameters are required to be answered before the result set can be retrieved. On step 8, another call to GET .../data.svc runs the query with the answers and saves the new data set in the cache.