J/CONNECTED SYSTEMS

API contract design for reliable integrations

Define API request meanings, version conflicts, response states and compatibility with examples both integration teams can test.

Start a conversation
JASMIR / A FIELD OF POSSIBILITY
01 / Connected systems

Which request meanings need to be explicit?

A message schema can validate while leaving critical behavior undefined. An empty field may mean unknown, remove the value or leave it unchanged. A success response may mean accepted rather than completed. These ambiguities become defects when different teams make reasonable but incompatible assumptions. An API contract needs to describe behavior at the business boundary as well as the shape of the payload.

02 / Connected systems

What belongs in a useful API contract?

Document the purpose, ownership and expected effect of each operation. Provide realistic examples for required, optional and absent values. Define identity, duplicate handling, authorization context and error categories. Distinguish failures a caller can correct from temporary conditions that may be retried. Explain whether an acknowledgement represents durable acceptance, completed work or only receipt. Test the contract using examples before coupling it to a complete application.

03 / Connected systems

How should old and new callers coexist?

A contract can become overloaded when it anticipates every possible consumer. Start with a clear responsibility and a considered change policy. Tolerating unknown fields can support compatibility, but silently ignoring a misspelled business instruction can also hide a mistake. Decide where strict validation protects meaning and where flexibility is intentional. Changes to default behavior may be more disruptive than adding a field and should receive explicit review.

04 / Connected systems

Which examples should a contract include?

Useful outputs include an operation description, example messages, validation rules, error catalogue and compatibility scenarios. Add operational identifiers that let teams trace a request without exposing sensitive payloads. Record who owns the contract and how changes reach its consumers.

05 / Connected systems

How can two teams test the same interpretation?

Have a consumer describe the result of the example messages without relying on the producer’s implementation. Differences in interpretation are useful review findings. Include a changed default, an optional value and a repeated operation so the review examines semantics rather than merely confirming that a schema parses.

An update contract both teams can test

Imagine a CRM and a customer portal sharing a customer record. A PM wants to remove an obsolete phone number without overwriting a colleague’s newer changes. This illustrative endpoint uses JSON Merge Patch for field meaning and a strong ETag for the version precondition.

Current representation returned by GET
HTTP/1.1 200 OK
ETag: "customer-C204-v7"
Content-Type: application/json

{"id":"C-204","name":"Northline Studio","phone":"+1-202-555-0142"}
Remove the phone only if version 7 is still current
PATCH /customers/C-204 HTTP/1.1
Content-Type: application/merge-patch+json
If-Match: "customer-C204-v7"

{"phone":null}

With JSON Merge Patch, an omitted member is unchanged and a null member removes that property. An empty string is a value, not an instruction to remove it. The endpoint must separately decide whether empty values are valid. This format is a poor fit when the resource needs to distinguish a stored null from an absent property.

Successful result — other fields survive
HTTP/1.1 200 OK
ETag: "customer-C204-v8"
Content-Type: application/json

{"id":"C-204","name":"Northline Studio"}

If another edit has already produced version 8, the stale precondition fails and this contract returns 412 Precondition Failed without applying the patch. The caller refreshes and resolves the difference rather than automatically overwriting it. HTTP’s If-Match rules define the precondition mechanism. Authorization and field permissions remain separate checks.

Review these cases together
Input or outcomeMeaning in this example
phone omittedKeep the stored phone value.
phone: nullRemove the optional phone property if the caller may edit it.
phone: ""Reject as invalid under this endpoint’s agreed validation policy.
Unrecognized writable fieldReject it rather than accepting an unintended update.
Stale If-Match valueDo not apply the update; return the documented precondition failure.
Response lost after updateRead the current record and reconcile. A conditional PATCH is not a substitute for a stored idempotency result.

Keep acceptance separate from completion

A different operation might return 202 Accepted while a background job runs. That response does not promise eventual success. Include an authorized status resource and explain how the caller learns about completion or failure. HTTP 202 semantics make this distinction explicit.

Before changing the contract, run these examples through both the current consumer and its proposed replacement. Check field meaning, permissions and outcomes—not just whether each JSON body passes a schema. This gives the teams a shared definition of done before the integration becomes expensive to change.

Bring one difficult handoff to Jasmir’s systems integration team. We can map the ownership, failure paths and first useful release around your workflow. See how these decisions fit together in the illustrative CRM and ERP project.

Questions worth checking.

  • Are absent, empty and unchanged meanings distinct?
  • Can callers interpret success accurately?
  • Do compatibility tests include old callers and changed defaults?
Start a conversation

NEXTYOUR VISION. OUR CODE.

What’s your
next big thing?

↗

A new idea. A difficult workflow. A better way forward.
Let’s find the right place to begin.

contact@jasmir.io ↗