I was able to get something working, although I never figured out why I couldn't pass in variables using additional scope. Future readers can read: REST API results differ when called directly versus from javascript - #10 by nl-setech for a workaround.