Closed mikail-khan closed 7 years ago
Hi @cokleisli ,
I am new here also, trying to get familiar with API Blueprint.
I understand simple GET method but POST is more difficult
## Resource 1 [/resource/?id=1]
+ Parameters
+ id (optional)- Path of resource
### Show resource [GET]
+ Response 200
...
### Post a Resource [POST]
+ Request (application/json)
{"question":"Do you want a Banana?"}
+ Response 201
+ Headers
Location: /resource/1
+ Body
{"answer":"You posted your question :)")
Can any body check our code and help us with advice?
Thank
@rakis10 your POST seems to be fine. What's the issue?
@cokleisli problem is that I cant GET resource/1. I am trying to POST some data and then access then with GET. Is that possible?
@cokleisli Yes, your blueprint looks idiomatic except for one thing. This is how I do it.
# Group User
## Users [/users]
### List all [GET]
### Create [POST]
## User [/user/{id}]
### Retrieve [GET]
### Update [PATCH]
### Delete [DELETE]
@rakis10 Looks like you are trying to say POST request should be sent to this url, /resource/?id=1
I'm new to Blueprint and I am still learning the underlying model. I fleshed out a simple CRUD service and it seemed odd to me that I needed to group the HTTP verbs according to the URI pattern. For example,
GET, PUT, and DELETE need an ID passed but for POST I don't.
Is this idomatic Blueprint or am I missing something? Is it not possible to avoid separating out the verbs like this.