API basics for beginners

API basics for beginners

🌱
No technical background needed. This page explains what an API is, in plain language, using everyday comparisons and real Protime examples. If you have never written a line of code, start here.

What is an API, really?

API stands for Application Programming Interface. That sounds intimidating, so forget the words for a moment and picture a restaurant.

  • You (the customer) want food, but you are not allowed into the kitchen.
  • The waiter takes your order, brings it to the kitchen, and returns with your meal.
  • The kitchen does the actual cooking, but you never see how.

An API is the waiter. It is the messenger that lets one system ask another system for something β€” without needing to know how the other system works inside.

In our world:

  • You = another program (for example, a payroll system or an HR tool).
  • The kitchen = Protime, where all the time and attendance data lives.
  • The waiter (API) = the Protime API, which carries requests back and forth.

So when someone says “connect your system to Protime through the API,” they simply mean: “let your software ask Protime questions and receive answers, automatically.”

Why do APIs exist?

Without an API, getting data out of Protime means a person logging in, clicking around, exporting a file, and emailing it. That is slow, manual, and easy to get wrong.

With an API, another system can ask for exactly what it needs, the moment it needs it β€” for example, “give me yesterday’s clockings for everyone in the warehouse” β€” and get a clean, structured answer in a fraction of a second. No human clicking required.

The one-sentence version: An API lets two software systems talk to each other automatically, so people don’t have to copy data by hand.

A conversation: request and response

Every API interaction is a short conversation made of two parts.

  1. A request β€” your system asks a question.
  2. A response β€” Protime sends back the answer.

Think of it like sending a very precise text message and getting a reply.

   Your system  ──── "Can I have the clockings for July 1st?" ───▢  Protime API
   Your system  ◀─── "Sure, here they are: [list of clockings]"  ───  Protime API

That is the whole idea. Everything else is just detail about how the question is phrased and how the answer is formatted.

You won’t be typing any of this yourself. The technical requests on this page are handled automatically by an integration tool or a developer. You’re here to understand the conversation, not to write it.

The five words you’ll hear most

You don’t need to memorise these, but recognising them makes every API conversation easier to follow.

Word What it means Restaurant comparison
Endpoint The specific “thing” you are asking about, like clockings or people. Each has its own web address. The section of the menu you order from
Request The question your system sends Placing your order
Response The answer Protime sends back The meal arriving at your table
JSON The tidy text format the answer comes in (see below) The way the plate is arranged so you can recognise every item
Token A temporary digital “pass” that proves you’re allowed to ask Your reservation confirmation at the door

What an answer looks like: JSON

When Protime replies, it doesn’t send a paragraph of text or a spreadsheet. It sends data in a format called JSON (pronounced “jay-son”). JSON is just a structured way of writing down facts so that both humans and computers can read it.

Here is a single clocking, written in JSON:

{
  "id": 18601,
  "date": "2026-07-01",
  "timeOfDayInMinutes": 510,
  "kind": "InOut",
  "person": {
    "id": 1
  }
}

You can read this almost like a form:

  • id β†’ a unique number for this clocking: 18601
  • date β†’ the day it happened: 1 July 2026
  • timeOfDayInMinutes β†’ 510 minutes after midnight, which is 08:30
  • kind β†’ the type of clocking: InOut
  • person β†’ who it belongs to: the person with id 1

The curly braces { } simply group facts together that belong to the same thing. That’s all JSON is: labels and values, neatly grouped.

“Read” versus “write”: asking versus changing

There are a few kinds of requests, but for understanding, only two matter:

GET
Reading β€” “Show me something.” You ask for data and Protime hands it over. Nothing is changed. Asking for a list of clockings is a GET.

POST
Writing β€” “Create or change something.” You send new information and Protime stores it. Adding a new clocking is a POST.

Tip

A handy mental model: GET is looking (safe, changes nothing), POST is doing (it creates or updates real data). The Protime API also uses PUT (update) and DELETE (remove), but they follow the same idea.

Why do I need a “token”?

Protime data is sensitive β€” it’s people’s working hours. So the API will not answer just anyone. Before asking questions, your system first proves who it is and receives a token: a temporary digital pass.

The flow is two simple steps:

  1. Show your credentials (a system’s username and password) β†’ Protime gives you a token, valid for 30 minutes.
  2. Attach that token to every question β†’ Protime trusts the question and answers.

It’s exactly like a conference: you show your ID once at registration, get a badge, and then the badge gets you into every session for the rest of the day.

A token is temporary on purpose. If it expired and someone copied it, it would stop working in minutes β€” much safer than handing out a permanent key.

Putting it all together: one real example

Let’s follow a complete, realistic request from start to finish. Imagine an HR system wants yesterday’s clockings for one employee.

Step 1 β€” Get a token (prove who you are):

HR system β†’ Protime: "Here are my credentials, may I have a token?"
Protime   β†’ HR system: "Yes. Here's your pass, good for 30 minutes."

Step 2 β€” Ask the question (with the token attached):

GET
/api/v1/clockings?filter=person in (1) and date ge '2026-07-01' and date le '2026-07-01'

In plain words, this address says: “Give me the clockings for person 1, on 1 July 2026.” The part after the ? is just a filter β€” the way you narrow down exactly what you want, like saying “only the warehouse team” or “only last week.”

Step 3 β€” Receive the answer (in JSON):

{
  "value": [
    { "id": 18601, "date": "2026-07-01", "timeOfDayInMinutes": 510,  "kind": "InOut", "person": { "id": 1 } },
    { "id": 18602, "date": "2026-07-01", "timeOfDayInMinutes": 1020, "kind": "InOut", "person": { "id": 1 } }
  ],
  "nextLink": null
}

Reading the answer:

  • value holds the list of results β€” here, two clockings.
  • The first is a clock-in at 510 minutes β†’ 08:30.
  • The second is a clock-out at 1020 minutes β†’ 17:00.
  • nextLink is null, meaning “that’s everything, there are no more pages.”

And that’s a full API interaction. Ask politely (with a token), be specific (with a filter), and receive a tidy answer (in JSON).

Common myths, cleared up

You might think… Actually…
“An API is a piece of software I install.” No β€” it’s a doorway into existing software (Protime). Nothing to install.
“I need to be a programmer to understand it.” To build an integration, yes. To understand and discuss one β€” like you’re doing now β€” no.
“The API gives away all our data to anyone.” No β€” every request needs a valid token, and tokens only grant the access you were given.
“JSON is complicated code.” JSON is just labels and values, like a structured form.

Where to go next

Now that the vocabulary makes sense, you can explore with confidence:

Further reading