title: What are the options for handling flags and attributes in a REST API?
body: <p>Let's say you have a complex resource in a REST API.  You have several one-to-many flags and attributes on this resource (i.e., a user may have given the resource a rating of 1 to 5 or the user may have 'liked' the resource or marked it as spam or ignored it or caused some other state to be set).</p>
  
  <p>Some suggestions have been made on the best way to represent this in a resource-centric architecture, but so far none of them have really made me happy.  So let's crowd-source this; which variants do you find easiest to understand?  Which variants haven't we thought of?  Assume an OAuth-based API and everything here is done in the context of the currently authorized user.</p>
  
  <ul>
  <li><p>Boolean Flags</p>
  
  <ul>
  <li><p>Variant 1:</p>
  
  <pre>
  GET /resource/{id}/muted
  POST /resource/{id}/muted BODY:true
  POST /resource/{id}/muted BODY:false
  </pre></li>
  <li><p>Variant 2:</p>
  
  <pre>
  GET /resource/{id}/muted
  PUT /resource/{id}/muted BODY:true
  DELETE /resource/{id}/muted
  </pre></li>
  <li><p>Variant 3:</p>
  
  <pre>
  GET /resource/{id}/attributes
  POST /resource/{id}/attributes BODY:muted=true
  POST /resource/{id}/attributes BODY:muted=false
  </pre></li>
  <li><p>Variant 4:</p>
  
  <pre>
  GET /resource/{id}/muted
  POST /resource/{id}/mute
  POST /resource/{id}/unmute
  </pre></li>
  </ul></li>
  <li><p>Attributes</p>
  
  <ul>
  <li><p>Variant 1</p>
  
  <pre>
  GET /resource/{id}/rating
  POST /resource/{id}/rating BODY:4
  </pre></li>
  <li><p>Variant 2:</p>
  
  <pre>
  GET /resource/{id}/rating
  PUT /resource/{id}/rating BODY:4
  DELETE /resource/{id}/rating
  </pre></li>
  <li><p>Variant 3:</p>
  
  <pre>
  GET /resource/{id}/attributes
  POST /resource/{id}/attributes BODY:rating=4
  POST /resource/{id}/attributes BODY:rating=
  </pre></li>
  </ul></li>
  </ul>
  
  <p>Thoughts?  Suggestions?  How have other APIs handled this?  How have you handled it?  Have you found that design issues like this have had significant effects on developer happiness or the ease-of-use of your APIs?</p>