Suppose that I have a endpoint that support three methods: GET, POST and PUT.
The type that will be returned contais two attributes: an id and a name. Both are required.
My question is about how to define this type in RAML definition, since on POST, the id should be crated automatically and on PUT the id will be a URI parameter. Do you guys creates two Types (one for GET and other for PUT, POST) or uses the same type for all operations, declaring the id as not required?
Sorry if this appears to be a such basic question, but I searched for this and didn't get any conclusive responses.
Thanks a lot!
Perhaps you can provide an example of how you expect it to work. Also please specify the RAML version you are using (assuming 1.0 for now).
Your endpoint provides a POST. That implies some kind of collection that you can add an item to. Then you can use the GET to retrieve such an item.
/collection(all items) and a/collection/12345678(one item alone, specifically, the item with id 12345678)/collection?id=12345678(a subset of the collection that happens to contain one item instead of multiple)Maybe, you could also look into the use of uriParameters.
To illustrate:
Please note that my example is not completely correct. It's about the concept rather than the precise syntax.