I am trying to get different responses passing different parameters but something is not working.
This is my API:
## Question [/questions/{question_id}]
A Question object has the following attributes:
+ Parameters
+ question_id: `1` (number, required) - ID of the Question in form of an integer
### View a Questions Detail [GET]
+ Request
+ Header
X-Custom-Header : 1
+ Response 200 (application/json)
{
"id": "1",
"name": "Marco"
}
+ Request
+ Header
X-Custom-Header : 2
+ Response 200 (application/json)
{
"id: "2",
"name": "Lucas"
}
But when calling /questions/1 or /questions/2 the response is always the same:
{
"id": "1",
"name": "Marco"
}
What is wrong?
Thank you
I believe there is a simple solution to do this without using headers:
Create different resources (one for each record), so each one will generate one URL.
## Note20 [/notes/20]
### Get notes20 [GET]
+ Response 200 (application/json)
{
"id" : 20,
"name" : "note xxxx"
}
## Note21 [/notes/21]
### Get notes21 [GET]
+ Response 200 (application/json)
{
"id" : 21,
"name" : "note yyyyy"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With