← Back to How-To Index
Web Services

What is a Web Service? (API)

Almost every modern app — whether it's a banking app, a weather app, or an e-commerce site — gets its data by talking to a web service. This guide explains what web services are, what an API is, and how REST (the most popular style) actually works. No jargon — just plain English and real examples.

1. What is a Web Service?

A web service is a way for two software systems to talk to each other over the internet. One system sends a request, the other processes it and sends back a response.

Restaurant Analogy

Think of a restaurant. You (the customer) don't walk into the kitchen to cook your own food. You tell the waiter what you want. The waiter takes your order to the kitchen. The kitchen prepares it. The waiter brings the food back to you.

In a web service: you are the application, the waiter is the API, and the kitchen is the server. You don't need to know how the kitchen works — you just need to know how to order.

Web services are used everywhere:


2. What is an API?

API stands for Application Programming Interface. It is the contract — the agreed set of rules — that defines how two systems will talk to each other.

The API defines:

Simple way to remember: An API is like a menu in a restaurant. It tells you exactly what you can order (endpoints), how to order it (method), and what you'll receive. You don't need to know what happens in the kitchen.


3. Types of Web Services

Over the years, different styles of web services have been invented. The three most common are:

Type Full Name Format Where Used
SOAP Simple Object Access Protocol XML Banking, government, old enterprise systems
REST Representational State Transfer JSON Almost everything modern — mobile apps, web apps, OutSystems
GraphQL Graph Query Language JSON Facebook, GitHub, Shopify APIs

SOAP is the oldest. It uses XML (lots of angle brackets — very verbose) and has very strict rules. It's still widely used in banking and enterprise systems but is considered complex.

GraphQL is a newer style where you ask for exactly the fields you want. Very flexible, but more complex to set up.

REST is the most popular style today. It's simple, uses the standard HTTP protocol you already know from browsing the web, and returns data in JSON — which is easy to read and work with. This guide focuses on REST.


4. RESTful APIs — The Most Important One

A RESTful API uses the same protocol your browser uses to load websites — HTTP. This makes it simple and universal. Any language (PHP, Java, Python, JavaScript) and any platform (OutSystems, mobile app, web app) can call a REST API.

The base URL

Every REST API has a base URL — the root address of the API:

https://labs.lowcademy.com/apis/

Endpoints

An endpoint is a specific path added to the base URL. Each endpoint represents a resource — something you can get or act on:

https://labs.lowcademy.com/apis/countries.php   ← list of countries
https://labs.lowcademy.com/apis/users.php       ← list of users
https://labs.lowcademy.com/apis/currency.php    ← currency converter

Key principles of REST


5. HTTP Methods

The HTTP method tells the server what action you want to perform. Think of it as the verb of the request.

Method What it does Real-world example
GET Retrieve / read data. Does not change anything on the server. Get a list of countries. Get a user's profile.
POST Send data to the server. Usually creates a new record or triggers an action. Submit a registration form. Create a new shipment.
PUT Update an existing record. Replaces the entire resource. Update a user's full profile.
PATCH Partial update. Changes only the specified fields. Change just the user's email address.
DELETE Remove a resource from the server. Delete a product. Close a ticket.

In OutSystems, you will use GET and POST most of the time. GET to fetch/read data, POST to send data or trigger actions. PUT, PATCH, and DELETE come up when you integrate with more advanced third-party APIs.


6. Anatomy of an API Request & Response

Every API call has two parts: what you send (the request) and what you get back (the response).

The Request

PartWhat it isExample
URLThe address of the endpointhttps://labs.lowcademy.com/apis/users.php
MethodThe action verbGET
Query ParamsExtra filters added to the URL with ?key=value?id=3&role=Admin
HeadersMetadata about the request — auth tokens, content typeAuthorization: Bearer xyz
BodyData sent with the request (POST/PUT only)JSON object with form data

The Response

PartWhat it is
Status Code200 = OK, 201 = Created, 400 = Bad Request, 401 = Unauthorized, 404 = Not Found, 500 = Server Error
BodyThe actual data, usually in JSON format
HeadersMetadata about the response — content type, cache info

7. JSON — How Data Travels

JSON (JavaScript Object Notation) is the standard format for sending and receiving data in REST APIs. It's lightweight and easy to read. You'll see it everywhere.

Basic JSON structure

{
  "success": true,
  "name": "India",
  "code": "IN",
  "population": 1400000000
}

JSON supports these data types: strings (text in quotes), numbers, booleans (true/false), arrays (lists), and objects (key-value pairs). An API response is almost always a JSON object at the top level.

JSON with an array of objects

{
  "success": true,
  "count": 3,
  "data": [
    { "id": 1, "name": "Ankit", "role": "Admin" },
    { "id": 2, "name": "Priya", "role": "User" },
    { "id": 3, "name": "Ravi",  "role": "User" }
  ]
}

8. Real Examples

Example 1 — GET with no parameters

Get a greeting from the Hello World API. No auth, no body needed.

Request

GET https://labs.lowcademy.com/apis/hello.php

Response

{
  "success": true,
  "message": "Hello, World!",
  "timestamp": "2026-07-12 10:30:00"
}

Example 2 — GET with a query parameter

Pass a name in the URL to personalise the response.

Request

GET https://labs.lowcademy.com/apis/hello.php?name=Ankit

Response

{
  "success": true,
  "message": "Hello, Ankit!",
  "timestamp": "2026-07-12 10:30:01"
}

Example 3 — GET with filter parameter

Fetch countries filtered by region.

Request

GET https://labs.lowcademy.com/apis/countries.php?region=Asia

Response

{
  "success": true,
  "count": 35,
  "data": [
    { "code": "IN", "name": "India",  "region": "Asia" },
    { "code": "JP", "name": "Japan",  "region": "Asia" }
  ]
}

Example 4 — GET with Basic Auth

Some APIs protect their endpoints with a username and password. The credentials are sent in the request header.

Request (cURL)

curl -u admin:1234 https://labs.lowcademy.com/apis/me.php

Response

{
  "success": true,
  "profile": {
    "id": 1,
    "username": "admin",
    "name": "Admin User",
    "role": "Administrator"
  }
}

9. API Authentication

Most APIs require you to prove who you are before they give you data. This is called authentication. Common methods:

MethodHow it worksExample
No Auth Open API — no credentials needed. Usually for public data. Country list, currency rates
Basic Auth Send username and password encoded in the Authorization header. Authorization: Basic YWRtaW46MTIzNA==
API Key A secret key sent in the header or query parameter. Header: x-api-key: abc123
Bearer Token A token (usually from a login call) sent in the Authorization header. Authorization: Bearer eyJhbGci...

Try These APIs Live

We've built a set of real, working REST APIs specifically for OutSystems training. All the examples in this guide point to live endpoints you can call right now — no signup needed for the open ones.

View Sample APIs →