Fork me on GitHub

What is the code-on-demand constraint, and why is it an optional constraint?

Code-on-Demand (COD) is the only optional constraint in REST. It allows clients to improve its flexibility because in fact it is the server who decides how certain things will be done. For instance, with Code-On-Demand, a client can download a javascript, java applet or even a flash application in order to encrypt communication so servers are not aware of any encryption routines / keys used in this process.

However, using COD reduces visibility, which is why this constraint is optional. Also, not every API needs this kind of flexibility.

See also

Caveats

  • Using code-on-demand reduces visibility.