Addition — Data as JSON Body
Adds two integers sent as a JSON request body. Uses POST method. No authentication required. Demonstrates how to structure input as a JSON payload instead of URL parameters.
Concept: JSON Request Body · POST Method · No Auth| Property | Value |
|---|---|
| Method | POST |
| File | add-body.php |
| Content-Type | application/json (required) |
| Authentication | None |
| Input style | JSON request body |
| Field | Type | Required | Description |
|---|---|---|---|
| input1 | Integer | Required | First integer to add |
| input2 | Integer | Required | Second integer to add |
{
"input1": 5,
"input2": 3
}cURL
curl -X POST https://labs.lowcademy.com/apis/add-body \ -H "Content-Type: application/json" \ -d '{"input1": 5, "input2": 3}'
JavaScript (fetch)
const res = await fetch('https://labs.lowcademy.com/apis/add-body', { method : 'POST', headers: { 'Content-Type': 'application/json' }, body : JSON.stringify({ input1: 5, input2: 3 }) }); const data = await res.json(); console.log(data.result); // 8
OutSystems — POST with JSON body
// Method: POST // Request → Body → Add structure with input1 (Integer) and input2 (Integer) // OutSystems serialises it as: {"input1": 5, "input2": 3}
{
"success" : true,
"operation": "addition",
"input1" : 5,
"input2" : 3,
"result" : 8
}