API Integration Knowledge Series · Part 2 of 4

Before build starts

API requirements and integration design — the analyst's half of the work.

Business need
? ? ?
Buildable requirements

Marko Hartikainen · cybernotes.it · → or space to advance · N notes · F fullscreen

The case · a familiar shape of pain

Four hours. Six percent. No one can see.

4 h
median, from report to registration
6 %
of claims carry a re-typing error
0
status the repair shop can see
Repair shop
e-mail
Inbox
re-typed by hand
Core claims system

the target — registered within a minute, status visible in the repair-shop portal

From part 1 · the promise

The questions you ask in week one decide whether the integration hurts in month six.

Today is week one.

Warm-up · part 1 showed this call as a simulation

This call is real. Run it.

  1. 1Open the docs api.cybernotes.it/mtpl/docs
  2. 2GET /coverage-options → Try it out → Execute
  3. 3Read it: verb · path · status · body
GET /mtpl/v1/coverage-options

        
HTTP 200 OK
content-type: application/json
ratelimit-remaining: 59

{
  "options": [
    {
      "code": "MTPL-STD",
      "name": "Mandatory motor liability",
      "term": "P1Y"
    }
  ]
}
From part 1 · the API you brought

Where did your API land — and what couldn't you answer?

request / responsepushmessagingbulkinfrastructure
  • Name it. Place it. Does the caller wait for the answer?
  • The one question about it you couldn't answer.

that unanswered question is what the checklists in this part are for

Part 2 of 4 · you are here

From a brief to a contract you can question

Discoverthe questions
SpecifyFR + NFR
Shape the designdiagrams · mapping · roles
Review a draftthe gap-hunt
1 Landscape ✓2 Requirements & design3 Security4 Docs, testing, lifecycle

parts 3 and 4 are in preparation · one break about halfway · the live API keeps coming back

The case · what the business handed over

The brief, and the systems behind it

Repair-shop portalvendor-hosted
FNOL
Core claims systemClaims API · source of truth
cover check
Policy APIlive · you just called it
enrich
Vehicle registryexternal · 100 calls a minute
nightly file
Reinsurer
The brief says:“register claims via API within a minute; show status in the portal.” It does not say:volumes · failures · duplicates · who owns what
Your turn · 2 minutes

What is your first question to this brief?

Write it down before the next slide.

One question. Ask for a fact, not a solution.

Concept · the discovery question set

Seven groups — which one did your question land in?

1Business context

what breaks without it?

2Systems & owners

both ends

3Data

source of truth · personal data

4Timing & volume

how fresh · the peak

5Failure tolerance

what may fail silently?

6Security & compliance

access · legal basis · retention

7Constraints

lead times · limits · versions

Open-questions log

“don't know yet” + owner + date

which group did nobody ask about?

Pro-tip · the discipline that makes discovery work

“REST API” is not an answer to “how fresh must the data be?”

✗

“We'll build a REST API.”

a solution

✓

“Within five minutes.”

a fact, in business units

Don't know yet? Open-questions log — owner and date.

Reveal · what the questions unearthed

None of this was in the brief

150 a day — 800 a day in a storm weekthe peak sizes the design
The shop waits for the claim numberintake: synchronous
Status within 5 minutes is finestatus: events, not polling
Registry down must not stop intakea fallback is needed
A claim registered twice is paid twiceduplicates: never
Portal vendor: REST and webhooks onlyconstraint beats preference
Checkpoint · 60 seconds, from memory

Which two groups are easiest to forget?

  • Name four of the seven.
  • Which answer changed the design most?
1 Context ✓2 Parties ✓3 FRs4 Mapping5 NFRs
6 Errors7 Security8 Tests9 Open items ✓
Spot the error · 60 seconds
requirement · draft
FR-X: The system prevents duplicate claims.
  • Which system? Prevents how?
  • What does the second sender see?
  • How would a tester prove it?
Demo · the Policy API has a rule of this kind

Sent twice. What comes back?

first time · recorded
POST /mtpl/v1/policies
{ "regNumber": "ABC-103" }

HTTP 201 Created
{ "id": "pol-7c41d2aa",
  "regNumber": "ABC-103",
  "status": "active",
  … }
sent again, unchanged · recorded
POST /mtpl/v1/policies
{ "regNumber": "ABC-103" }
Predict the answer.
HTTP 409 Conflict
content-type: application/problem+json
{ "type": ".../duplicate-policy",
  "title": "Vehicle already has
            an active policy",
  "status": 409,
  "conflictingPolicyId":
            "pol-7c41d2aa", … }

creating a policy needs a token — that lock is part 3

Concept · what that exchange was made of

Five parts. You just watched all five.

Triggera partner signs a vehicle up
OperationPOST /policies
Ruleone active policy per vehicle
Outcome201 · the new policy's id
Unhappy path409 · the rule named · the existing policy's id

a requirement missing its unhappy path is half a requirement

Before → after · the same intention, buildable
requirement · FR-2 · duplicate protection
Trigger:    a repair shop submits an FNOL in the portal
Operation:  POST /claims with an Idempotency-Key —
            one key per FNOL, reused on retry
Rule:       same key again → the original claim is returned,
            no second claim. Same policy and incident under
            a different key → 409 DUPLICATE_CLAIM
Outcome:    the portal shows the returned claimId
Unhappy:    on timeout the portal retries with the SAME key —
            the duplicate is detected and suppressed

before “Rule” appears — what would you write there?

The spine question

Ask every arrow: “what happens when it fails?”

Every answer is a requirement.

The question, applied · the registry is silent

The fallback is a business decision

Claims system
enrich · 3 s
Vehicle registry
no answer?
register anywayflag ENRICHMENT_PENDING
3 seconds24 hours of retriesthen a human worklist

Who chose those numbers? The business did. The analyst asked.

Your turn · 2 minutes · the other arrow

The Policy API does not answer. Now what?

No answer within → the claim is .

Then for , and after that .

Which blanks can you fill in on your own?

Demo · your turn at the API · predict first

Now you create a policy

Your tab: POST /policies → Try it out → Execute. Which status, and why?

POST /mtpl/v1/policies — no token

      
HTTP 401 Unauthorized
www-authenticate: Bearer
content-type: application/problem+json

{
  "type": "https://api.cybernotes.it/problems/unauthorized",
  "title": "Missing bearer token",
  "status": 401,
  "detail": "Send an 'Authorization: Bearer <token>' header. Get a token from POST /mtpl/v1/auth/token.",
  "instance": "/mtpl/v1/policies"
}
Checkpoint · from memory

Four answers from one API. What did each mean?

200201409401
  • Whose move is it after each one?
  • What did each body tell you to do?
1 Context ✓2 Parties ✓3 FRs ✓4 Mapping5 NFRs
6 Errors ✓7 Security8 Tests9 Open items ✓
Break

Six minutes.

Next: the requirements that hide.

Stretch. Water.

Concept · the requirements that hide

NFRs: numbers, not adjectives

an adjectivea number a tester can verify
“must be fast”p95 ≤ 2 s at the storm peak, registry lookup included
“handle the load”150 a day · 800 a day in a storm week · 100 an hour at peak
“always up”99.5 % monthly · maintenance Sunday 02–04
“log everything”every registration traceable by traceId · kept 7 years

p95 = the time 95 % of calls beat — one call in twenty may be slower

Your turn · rewrite drill · 2 minutes

Rewrite: “status updates must be reliable.”

A number, a unit, a condition — for this case.

Reliable against what: loss, delay or disorder?

Demo · a limit you can watch

Their limit becomes your requirement

GET /mtpl/v1/limited/ping

        
#1  200 OK  ratelimit-remaining: 4
#2  200 OK  ratelimit-remaining: 3
#3  200 OK  ratelimit-remaining: 2
#4  200 OK  ratelimit-remaining: 1
#5  200 OK  ratelimit-remaining: 0
#6  429 Too Many Requests  retry-after: 47
This endpoint allows 5 requests per minute per client address. Try again in 47 seconds.

Policy API: 60 calls a minute. Registry: 100.

After an outage, retries drain at half of that.

On a 429: wait for Retry-After. Three in a row → alert.

Concept · observability as requirements

Write down who notices

Alerterror rate above 2 % over 5 minutes → claims-ops on call
Traceone traceId through every system a request touches
Auditwho registered what, from where, when — kept 7 years
The division of labour

Numbers come from the business. Feasibility comes from the architects.

you bringthe architect brings
freshness · volumes · peaksthe integration pattern
failure tolerance · fallbacksmiddleware · reuse
data ownership · classificationsecurity mechanics
what an hour of downtime costseffort · feasibility

expect two or three options back · the choice is recorded with its reason

Concept · the diagram that finds open questions

Can't draw the else branch? You've found your open question.

else · registry silent for 3 s 201 · claimId · ENRICHMENT_PENDING (retry 24 h → worklist) else · Policy API silent ? (your answer from the exercise) else · same Idempotency-Key again the original claim — no second one Portal Claims system Policy API Vehicle registry POST /claims + Idempotency-Key cover check in force enrich vehicle data 201 · claimId
Your turn · 90 seconds · two traps are hiding

Mapping finds what nobody asked

target · our claim recordsource · registryrule
registrationNumberreg_numberuppercase, no spaces
vinvin_codecopy · may be absent
firstRegistrationDatefirst_reg_dateDD.MM.YYYY → ISO date
fuelTypefuel_typelowercase → UPPERCASE
—statusdropped: no target field

fuel_type: gas — no such value in the target. Owner: product. Don't guess.

status: stolen — handlers need it for theft claims. A new requirement.

null ≠ absent ≠ empty · template and full exercise on the training page

Concept · who, and when

Roles enter during analysis — not at the security review

CONTACT · work with directly

Business Owner

Product Owner

●System Owner — each end

Data Owner

Tech Lead

●Vendor's technical contact

The other side's analyst

CONSULT · at decision points

Solution · Integration · Enterprise Architect

Security Architect

IAM

●DPO

Compliance / Risk

Network

API Platform Owner

QA Lead

INFORM · they inherit it

Operations / Support

Monitoring Owner

Release Manager

● late = weeks

the cheapest meeting is the one in week one

Exercise · pairs · 7 minutes

Switch seats: now you review someone else's contract

  • The Policy API's first draft is all you have.
  • Follow it. Try its calls. Where does it let you down?
  • One point per gap, phrased as a question to its owner.

api.cybernotes.it/mtpl/v0/docs

six gaps are planted · you have already met three of them today

Exercise · the suspect
7:00
v0 draft · operations and responses
base path: /mtpl/v1

/coverage-options      get → 200
/policies              get → 200
                       post → 201
/policies/{id}         get → 200, 404
                       put → 200
/policies/{id}/cancel  post → 200
/limited/ping          get → 200
  “Connectivity check”
/signed/policy-check   post → 200
  needs X-Signature

components: schemas only
v0 draft · the request schema
PolicyRequest:
  required: [vehicleId]
  vehicleId:  string
    “The vehicle identifier.”
  holder:     string

POST /policies — two examples,
both titled “By vehicle id”:
  vehicleId: ABC-101
  vehicleId: 5TDEM000000000103

ask it what this part asked: access · refusals · identifiers · rules · volume · limits

Reveal · six gaps, six questions
the draftyour questionthe live spec answers
1 · no access ruleshow do callers get in?a bearer token on five operations
2 · one 404, nothing elsewhat does “no” look like?every 4xx listed, one format
3 · vehicleId: plate or VIN?which identifier?regNumber and vin, separately
4 · no business rulesalready insured — then what?409 duplicate-policy
5 · “the list” of policiesand at 70 policies?page · pageSize, 100 at most
6 · no limitswhat are the limits?60 a minute · Retry-After

same API, two specifications — the difference is the work this part teaches

Back to the case

What would you now write down?

4 h→ intake through the Claims API · p95 ≤ 2 s
6 %→ field-by-field mapping · nothing re-typed
0→ status events within 5 minutes · an alert on silence

Your turn: the one question you will ask on your next integration.

1 Context ✓2 Parties ✓3 FRs ✓4 Mapping ✓5 NFRs ✓
6 Errors ✓7 Security · part 38 Tests · part 49 Open items ✓
Before you go

Take it with you

the materials

Questionnaire · two templates · NFR checklist · roles map · mapping exercise

on the training page

try one

Questionnaire on your own API · mapping exercise · or get a token:

api.cybernotes.it/mtpl/start

part 3

POST /policies said 401. Part 3 opens it: tokens, scopes, the controls in between.

slides and PDF → cybernotes.it/trainings/api-integration/2-requirements-and-design

Appendix · the requirements pack — reference, not memory work

What a complete pack contains

1Overview and context diagram — who talks to whom
2Parties and environments — owners at both ends, sandbox, test data
3Functional requirements — trigger · operation · rule · outcome · unhappy path
4Data mapping — target-first table, value-by-value code lists, gap log
5Non-functional requirements — numbers with units and conditions
6Error handling and reconciliation — else branches, retries, source of truth
7Security and data protection — part 3
8Acceptance criteria and test scenarios — part 4
9Open items — every unknown, an owner, a date
Appendix · jargon decoder — requirements and process
FNOLfirst notice of loss — the first report of a claim
discoveryestablishing the facts before design
open-questions logevery unknown, with an owner and a date
FR · NFRwhat it does · how well it must do it
unhappy paththe decided behaviour when a step fails
idempotency keyone key per business action, reused on retry, so a repeat is detected
p95the time 95 % of calls beat
SLAthe service level a provider commits to
RTO · RPOhow fast back after a failure · how much data may be lost
traceIdone identifier carried through every system a request touches
source of truththe one authoritative system for a data item
dead-letter queuewhere messages that could not be processed wait for a person
Appendix · jargon decoder — contracts, data and people
OpenAPIthe standard machine-readable description of a REST API
AsyncAPIthe same idea for event and message interfaces
Swagger UIa browsable, clickable rendering of an OpenAPI file
problem+jsona standard machine-readable error body (RFC 9457)
rate limit · 429a cap on calls per period · the refusal when it is exceeded
enuma closed list of allowed values — map them one by one
gap logthe mapping's unmappables, each with an owner
sandboxa safe non-production copy of an API
compensationundoing a finished step because a later one failed
reconciliationchecking afterwards that both sides agree
SA · DPO · IAMsolution architect · data protection officer · identity and access management
bordereauxthe periodic claims and premium file sent to a reinsurer

part 3 adds the security vocabulary

1 / 38
Notes · press N to close