It's important to make sure that you understand the semantics of PUT
A successful PUT of a given representation would suggest that a subsequent GET on that same target resource will result in an equivalent representation being sent in a 200 (OK) response.
In other words
PUT /collection
means "replace the representation of /collection with the representation included in this message".
So that's the right request to use if you are trying to modify the representation of the collection resource itself, and the wrong thing to do if you are trying to modify the representation of something else.
For example, if the representation of the collection was a list of descriptions of its elements, then you could use PUT to replace the list with a different one.
GET /collection
200 OK
[1, 2, 3]
PUT /collection
[4, 5]
204 No Content
GET /collection
[4, 5]
In other words, from the point of view of REST, "collections" use the exact same messages, with the same semantics, as every other resource.
If what you are trying to describe is a change to some other resource, then you use the identifier for that resource
PUT /collection/1
Now, should that identifier "1" be in the representation? It depends - but here is the basic rule: consumers (and intermediary components) should never be trying to extract information from the URI, only from the representations. So if your consumer use cases need that "1", then it needs to appear in the representation of the resource.
PUT is, in this sense, just the dual of GET -- if GET needs to include information in the representation provided by the response, then PUT needs to include that same information in the representation provide by the request.
It may be useful to think of file contents - we put the information that the reader needs into the file, the file name/path just tells the reader how to find it. Or if you think about a Hash/Map/Dictionary -- the key is used to get values in and out of the map, but the information is in the value.
If I am not planning to support complete collection replacement
... then PUT /collection
is wrong, because we have all agreed (via RFC 7231) that PUT
means "replacement".
It's okay to use POST, instead of PUT
, if you are trying to manipulate /collection
in some non standardized way.
If you are intending to manipulate the representation of the collection, but you want to describe inserts and removals rather than sending the entire representation every time, you could use PATCH with some sort of patch document that describes your changes.