title: RESTful API Multiple Query Strings over multiple Resources for Filtering
body: <p>Let´s assume there is an entity companies and an entity nations. A company can belong to many nations and a nation can have multiple companies. So there is a intermediate table memberships with different roles for the companies e.g. a company is a manufacturer in a nation and another company is for example a supplier in a nation. A nation can have multiple status like is_active etc.</p>
  
  <p>Now we want to fetch all nations from a specific company where the role is manufacturer and the state of the nation is is_active = false.</p>
  
  <p>How could a RESTful API endpoint look for this use case? Is it allowed to filter over multiple resources? Some ideas:</p>
  
  <pre><code>GET /companies/{id}/nations?role=manufacturer&amp;is_active=false
  
  GET /memberships/{id}/nations?role=manufacturer&amp;is_active=false
  </code></pre>
  
  <p><strong>UPDATE</strong>
  Maybe my question was not clear enough. The query string parameters make a lookup in two different tables/entities. The role is inside the memberships entity and the is_active is inside the nations entity. I thought that filtering is allowed only on the requested resource. Maybe I could split up the question in two use cases.</p>
  
  <p>1) Is it "better" to go with the intermediate resource in the URI?
  2) Can we filter a resource with query string parameters over multiple tables/entities?</p>