Sort the rest API routes so that they are in a stable order.

Addresses issue #494.
Why not use a simple Python iterator? You're not modifying "op" and not using "i" for any purpose other than in "op[i]".