Addition — With Basic Authentication
Adds two integers, but requires HTTP Basic Auth before responding. The client encodes username:password in Base64 and sends it in the Authorization header.
| Property | Value |
|---|---|
| Method | GET |
| File | add-basic.php |
| Authentication | HTTP Basic Auth |
| Input style | URL query parameters |
Basic Auth encodes username:password as Base64 and sends it in the Authorization: Basic <encoded> header. Most HTTP clients handle this automatically when you choose "Basic Auth".
Lab Credentials — For Training Use Only
| Parameter | Type | Required | Description |
|---|---|---|---|
| input1 | Integer | Required | First integer to add |
| input2 | Integer | Required | Second integer to add |
cURL (Basic Auth shorthand)
curl -u admin:1234 https://labs.lowcademy.com/apis/add-basic?input1=5&input2=3cURL (manual header)
curl -H "Authorization: Basic YWRtaW46MTIzNA==" \ https://labs.lowcademy.com/apis/add-basic?input1=5&input2=3
JavaScript (fetch)
const res = await fetch('https://labs.lowcademy.com/apis/add-basic?input1=5&input2=3', { headers: { 'Authorization': 'Basic ' + btoa('admin:1234') } }); const data = await res.json();
OutSystems — Basic Authentication
// In Consume REST API → Authentication → Basic Authentication // Username: admin // Password: 1234 // OutSystems encodes and sends the Authorization header automatically
{
"success" : true,
"auth_method": "Basic Auth",
"operation" : "addition",
"input1" : 5,
"input2" : 3,
"result" : 8
}