POST only collections


#1

I have an API where I can do the following operations:
POST /automobiles
GET /automobiles/{id}

But I do not allow
GET /automobiles

In the generated documentation, for /automobiles, there is both a POST (correct) and GET (incorrect) button. Clicking on GET shows an empty page. I was playing around with the RAML, and I discovered that if I remove the GET /automobiles/{id} entry, then the /automobiles correctly shows just POST.

Is there a reason why adding the GET /automobiles/{id} causes a GET to show up on the /automobiles resource?

My RAML looks like this:

/automobiles:
  type: <referenced type>
  get:
  /{id}
    type: <referenced type>

#2

Hi Rocket96,

In the RAML you’ve included above, the get is actually applied to the /automobiles resource, not to the /automobiles/{id} resource. If you change the RAML to something like the below, I think you should see the desired behavior.

/automobiles:
  type: <referenced type>
  /{id}:
    type: <referenced type>
    get:

Hope that helps!


#3

Ah thanks! that worked wonderfully and simply!