External API Contract (REST)

*Status:* v1.0 authoritative · Owner: Backend team · Last reviewed: 2026-06-26

This is the outward-facing REST API that other systems consume: OSS/BSS, integrators and partner services (repositories ft-northbound-api, ft-service-api, ft-provision-api). Backend engineers and integrators read it. The living contract is the OpenAPI spec (springdoc / Swagger UI). The rules below are the FT conventions that the spec must follow (see also the Java standard, J13).

FT has two API surfaces. Do not mix them. The internal UI↔BE API is POST-RPC (see the Internal API Contract). The external API is this page.
ext-contract-flow

The contract

Element Shape Notes

Style

REST: @RestController + @RequestMapping("api/<Resource>"); the verb follows the semantics of the operation

<Resource> is PascalCase (api/Device, api/Provision, api/Task). The API is unversioned (no /v1) and additive-only.

DTOs

Request *RestRequest, response *RestResponse. A list is Get<Resource>Response that wraps List<…​Dto>.

No ICollection envelope (that belongs to the internal surface).

Ack and error envelope

StatusResponse { Integer errorCode, String message }. errorCode 100 means success. 20X means failed (the codes are in the table below).

The external catalog. It is distinct from the internal 90xx catalog. Do not mix them.

Error transport

HTTP 200 plus the StatusResponse body for a domain or validation error, so a client reads errorCode, not the HTTP status. An unauthenticated call gets 401, and an unexpected failure gets 500.

External layer (J13). In ft-northbound-api: FTApiRestRequestInterceptor.java:114,123,132,139.

Auth

Authorization: Bearer <JWT> (Spring Security); 401 or 403 on failure

See J15

Docs

OpenAPI via springdoc: @Tag, @Operation, @Schema. Swagger UI is the contract that consumers read.

A public endpoint without OpenAPI is incomplete.

Error codes of StatusResponse

errorCode Meaning

100

Success. The operation was performed successfully.

201

No CPE

202

No DB

203

Incorrect request structure, non-writable parameter or node

204

General error

205

No ACS

206

No CPE for NewSN

207

No CPE for CurrSN

Source: the comment of StatusResponse in ft-provision-api, file src/main/java/com/friendly/provisionportal/nbi/response/StatusResponse.java:11-21. CPE means customer premises equipment (the device). ACS means Auto Configuration Server. The JSON property names in that class are ErrorCode and Message (StatusResponse.java:33,40). The Java field names are errorCode and message. ft-northbound-api and ft-service-api use the class of the same name from the shared library, ft-libs/shared-dto/src/main/java/com/friendly/shareddto/api/base/response/StatusResponse.java, with the same codes and the same JSON names.

One exception: ProvisionController in ft-provision-api answers in an older shape (Result with 100 or 200, Message, Bid, Status). New code does not copy it.

Operations: verb per kind (REST)

Operation Verb Path and body Response

List or query

GET (simple) or POST (filtered)

api/<Resource> (plus a filter body for POST)

Get<Resource>Response / List<Dto>

Get by id

GET or POST

api/<Resource> with the id (in the path or in the body)

*RestResponse

Create

POST

api/<Resource> *RestRequest

*RestResponse / StatusResponse

Update

PUT

api/<Resource> *RestRequest

*RestResponse / StatusResponse

Delete

DELETE

api/<Resource> (may carry a *RestRequest body)

StatusResponse

Action (RPC-like)

POST

api/<Resource> (for example api/Rpc, reprovision) *RestRequest

*RestResponse

The verb follows the semantics of the operation, but the northbound surface is action-heavy. Many operations are POST or PUT with a request DTO in the body, not REST with a resource id in the path. Use GET for a simple read without side effects. Use POST when the read needs a filter body. The sources define no further criterion for GET or POST.

Validation and errors

The Java standard defines the implementation (J13, HTTP APIs). Use @Valid or @Validated at the boundary. Use one global @RestControllerAdvice per service. Do not use a try/catch in a controller. Never leak stack traces. On this surface the advice maps a domain or validation error to HTTP 200 plus a StatusResponse.

Stability and change control

Outside systems consume this API. Treat every change as breaking by default.

  1. No versioning, additive-only. Paths stay api/<Resource>: no /v1 and no version header. The API evolves only additively. New optional fields and new endpoints or resources are safe. You may never remove or rename a field, or change a verb or status on an existing endpoint. A genuinely breaking change ships as a new resource or endpoint, and the old one keeps working. Compatibility comes from never breaking, not from versioning.

  2. The error catalog is separate. This surface owns StatusResponse.errorCode (100 success, 20X failed). It is deliberately distinct from the internal 90xx catalog (Internal API Contract). Do not reuse internal 90xx codes here. Do not leak external codes into the internal surface.

  3. The OpenAPI spec is the contract. Regenerate and review it on every change.