Introduction
Sample Rest Service can accept simple request and return response based on the input provided:
-
If the input contains and id that is greater than zero, then response returned with valid status and input is duplicated
-
If the input contains id that is zero or less, or missing and id, then response returned with invalid status and input is duplicated
HTTP status codes
Sample Rest Service tries to adhere as closely as possible to standard HTTP and REST conventions in its use of HTTP status codes.
Resources
cURL example
$ curl 'http://localhost:39579/process' -i -X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json; charset=UTF-8' \
-d '{
"id": 123,
"name": "Hello"
}'
Request body
{
"id": 123,
"name": "Hello"
}
Path | Type | Description |
---|---|---|
|
|
Id of the input that is bigger than 0 |
|
|
Name of the input |
Response body
{"valid":true,"message":"Received: Input(id=123, name=Hello)"}
Path | Type | Description |
---|---|---|
|
|
Indicated whether input message was valid |
|
|
Some message about the request processing |
Invalid request
{
"id": -987,
"name": "Hello"
}
Invalid response
{"valid":false,"message":"Id should be > 0. Received: Input(id=-987, name=Hello)"}