What is a REST API?
◈ CORE DEFINITION
REST (Representational State Transfer) is an architectural style for building web services. A REST API (Application Programming Interface) exposes backend system data and operations over HTTP using standard methods.
In the IoT/Telecom world, REST APIs are how systems talk: the ordering system calls the billing system, the CRM pushes activations to provisioning, and mediation platforms exchange usage records — all via REST or SOAP/XML endpoints.
6 REST Constraints: Stateless · Client-Server · Cacheable · Uniform Interface · Layered System · Code on Demand (optional)
Stateless = The server stores NO session info. Every request must contain all the context it needs. Critical for scalable telecom APIs with millions of IoT device calls.
CRUD Operations — HTTP Method Mapping
Creates a new resource on the server. The request body contains the data. The server assigns the ID.
- ◈ Endpoint:
POST /api/devices - ◈ Body: JSON payload with resource data
- ◈ Success response: 201 Created
- ◈ NOT idempotent — calling twice creates two records
- ◈ Telecom use: Activate new IoT SIM, create billing account, open service order
Retrieves data from the server. No body in request. Safe and idempotent — never changes server state.
- ◈ Endpoint:
GET /api/devices/{id} - ◈ Parameters: Path params, query strings
- ◈ Success response: 200 OK
- ◈ Idempotent — same result every call
- ◈ Telecom use: Fetch IoT device status, query subscriber record, retrieve invoice
Replaces an entire resource. Must send ALL fields even ones not changing. Idempotent.
- ◈ Endpoint:
PUT /api/devices/{id} - ◈ Body: Complete resource representation
- ◈ Success response: 200 OK or 204 No Content
- ◈ Idempotent — same result if called multiple times
- ◈ Telecom use: Full service plan update, replace billing profile
Updates only the specified fields. More efficient than PUT — send only what changed.
- ◈ Endpoint:
PATCH /api/devices/{id} - ◈ Body: Only the fields being updated
- ◈ Success response: 200 OK
- ◈ May or may not be idempotent depending on implementation
- ◈ Telecom use: Update IoT data plan tier, change device status flag
Removes a resource from the server. Idempotent — deleting something twice returns 404 on the second call, which is acceptable.
- ◈ Endpoint:
DELETE /api/devices/{id} - ◈ No request body typically
- ◈ Success response: 200 OK or 204 No Content
- ◈ Idempotent in intent
- ◈ Telecom use: Deactivate IoT device, cancel service order, remove subscriber
HTTP Status Codes You Must Know
REST API Code Examples — Telecom IoT Context
## POST — Create new IoT device subscription (Telecom Ordering API) ## Endpoint: POST /api/v2/iot/devices ## Platform: AT&T IoT Backend · CRM Integration POST https://api.att.iot.com/v2/devices Content-Type: application/json Authorization: Bearer {oauth2_token} X-Correlation-ID: ORDER-2026-039471 ## REQUEST BODY { "iccid": "89014103211118510720", // SIM card identifier — MANDATORY "imei": "358240051111110", // Device hardware ID — MANDATORY "ratePlan": "IOT-1MB-POOLED", // Billing rate plan — MANDATORY "accountId": "ACC-00482910", // Parent billing account — MANDATORY "servicePriority": "STANDARD", // STANDARD | PREMIUM | CRITICAL "activationDate": "2026-03-22", // ISO 8601 — optional, defaults to today "customFields": { "fleetId": "FLEET-TX-0047", // OPTIONAL — customer-defined metadata "assetTag": "SENSOR-UNIT-119" } } ## SUCCESS RESPONSE — 201 Created { "deviceId": "DEV-7829341", // Server-assigned ID — NOTE THIS "status": "PROVISIONING", // PROVISIONING → ACTIVE (async) "orderId": "ORD-20260322-4410", // Fulfillment order reference "message": "Device activation initiated" } ## ERROR RESPONSE — 422 Unprocessable Entity ## Triggered when: iccid already active, invalid rate plan, account suspended { "error": "ICCID_ALREADY_ACTIVE", "field": "iccid", "code": 42201, "message": "SIM 89014103211118510720 is already assigned to account ACC-00480001" }
## GET — Read IoT device record(s) ## Platform: CRM / Subscriber Management API ## Single resource — path parameter GET https://api.att.iot.com/v2/devices/DEV-7829341 Authorization: Bearer {oauth2_token} ## Collection with filters — query parameters GET https://api.att.iot.com/v2/devices?accountId=ACC-00482910&status=ACTIVE&page=1&limit=50 ## SUCCESS RESPONSE — 200 OK { "deviceId": "DEV-7829341", "iccid": "89014103211118510720", "status": "ACTIVE", "ratePlan": "IOT-1MB-POOLED", "dataUsageMB": 0.72, "lastSeen": "2026-03-22T14:30:00Z", "billingCycleEnd": "2026-03-31" } ## INTERVIEW TIP: GET is SAFE + IDEMPOTENT ## Safe = no side effects, never changes data ## Idempotent = calling 1x or 100x gives same result ## Always use GET for data retrieval — NEVER POST just to read ## PAGINATION PATTERN used in high-volume telecom APIs: { "data": [ /* array of devices */ ], "pagination": { "total": 48291, "page": 1, "limit": 50, "nextCursor": "eyJpZCI6IjUwIn0=" } }
## PUT — Full replace of device record (idempotent) ## MUST send ALL fields or missing fields get nulled PUT https://api.att.iot.com/v2/devices/DEV-7829341 Content-Type: application/json { "iccid": "89014103211118510720", "imei": "358240051111110", "ratePlan": "IOT-5MB-POOLED", // ← Changed from 1MB to 5MB "accountId": "ACC-00482910", "servicePriority": "PREMIUM", // ← Upgraded "activationDate": "2026-03-22" // ALL fields required — omitting = null } ## Response: 200 OK or 204 No Content ───────────────────────────────────────── ## PATCH — Partial update (only send what changed) ## More common in modern telecom APIs — efficient for IoT at scale PATCH https://api.att.iot.com/v2/devices/DEV-7829341 Content-Type: application/json { "ratePlan": "IOT-5MB-POOLED", // Only what changed "servicePriority": "PREMIUM" } ## KEY INTERVIEW POINT — PUT vs PATCH: ## PUT = replace the whole thing (like overwriting a config file) ## PATCH = update specific fields (like editing one line in a file) ## In telecom billing: PATCH to change rate plan, not PUT ## Wrong method = unintended field nullification = billing errors
## DELETE — Deactivate / remove IoT device ## Platform: AT&T Provisioning / Switch Control Interface DELETE https://api.att.iot.com/v2/devices/DEV-7829341 Authorization: Bearer {oauth2_token} X-Reason: CUSTOMER_REQUEST ## SUCCESS: 204 No Content (nothing to return) ## OR: 200 OK with confirmation body { "deviceId": "DEV-7829341", "status": "DEACTIVATING", "estimatedCompletion": "2026-03-22T15:00:00Z" } ## SECOND CALL (idempotent check): ## DELETE /v2/devices/DEV-7829341 (again) ## Returns: 404 Not Found — resource already gone — ACCEPTABLE ## TELECOM CRITICAL NOTE: ## Hard delete vs soft delete — most telecom APIs do SOFT DELETE ## status = "DEACTIVATED" in DB, not physically removed ## Why? Billing history, audit trails, SOX compliance ## The DELETE endpoint triggers deactivation workflow in: ## 1. Switch Control / HLR → remove from network ## 2. Billing → prorate final invoice ## 3. CRM → update subscriber record ## 4. Sales Comp → trigger churn credit back
## SOAP vs REST — Critical for AT&T interview (legacy + modern systems) ┌─────────────────┬──────────────────────────┬──────────────────────────┐ │ │ REST │ SOAP │ ├─────────────────┼──────────────────────────┼──────────────────────────┤ │ Format │ JSON, XML, any │ XML only (strict) │ │ Transport │ HTTP/HTTPS │ HTTP, SMTP, TCP │ │ Contract │ OpenAPI/Swagger (loose) │ WSDL (strict schema) │ │ Error Handling │ HTTP status codes │ SOAP Fault envelope │ │ Security │ OAuth2, JWT, API Keys │ WS-Security │ │ Statefulness │ Stateless │ Can be stateful │ │ Telecom Usage │ New IoT APIs, microsvcs │ Legacy BSS/OSS, billing │ └─────────────────┴──────────────────────────┴──────────────────────────┘ ## SOAP Request Example (legacy billing system — still common in AT&T) <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bill="http://att.com/billing/v1"> <soapenv:Header> <bill:AuthToken>Bearer eyJh...</bill:AuthToken> </soapenv:Header> <soapenv:Body> <bill:GetInvoiceRequest> <bill:AccountId>ACC-00482910</bill:AccountId> <bill:BillingPeriod>2026-02</bill:BillingPeriod> </bill:GetInvoiceRequest> </soapenv:Body> </soapenv:Envelope> ## INTERVIEW ANSWER for "REST vs SOAP": ## "In my AT&T/TEOCO work, we used both. Legacy billing ran on SOAP/XML ## interfaces with strict WSDL contracts. New IoT microservices use REST ## with JSON. The challenge is integration between them — marshaling data ## across protocol boundaries while preserving field fidelity."
## SCHEMA VALIDATION — Critical for this IoT Interface Architect role ## The job is literally: validate API schemas against business rules ## JSON Schema example — IoT Device activation request { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": ["iccid", "imei", "ratePlan", "accountId"], "properties": { "iccid": { "type": "string", "pattern": "^[0-9]{19,20}$", // MANDATORY — 19-20 digit SIM ID "description": "SIM card identifier" }, "ratePlan": { "type": "string", "enum": ["IOT-1MB-POOLED", "IOT-5MB-POOLED", "IOT-UNLIMITED"], // MANDATORY with allowed values — billing constraint }, "activationDate": { "type": "string", "format": "date" // OPTIONAL — defaults to today in backend }, "customFields": { "type": "object" // OPTIONAL — but this is where hidden deps lurk } } } ## HIDDEN DEPENDENCY (the core of this role): ## customFields.fleetId is OPTIONAL in schema ## BUT downstream billing system REQUIRES fleetId for ## corporate accounts with fleet billing enabled ## → Schema says optional → Business logic says mandatory ## → Defect hits in billing, not at API validation ## → This is EXACTLY what the IoT Interface Architect must catch
RESTful Endpoint Design — IoT Device API
| Method | Endpoint | Operation | Status Codes | Notes |
|---|---|---|---|---|
| GET | /v2/devices | List all devices (paginated) | 200, 400 | Use query params for filters |
| POST | /v2/devices | Activate new IoT device | 201, 400, 409, 422 | 409 = duplicate ICCID |
| GET | /v2/devices/{deviceId} | Get single device record | 200, 404 | Include billing + network status |
| PUT | /v2/devices/{deviceId} | Full update of device record | 200, 400, 404 | All fields required |
| PATCH | /v2/devices/{deviceId} | Change rate plan / status | 200, 400, 404, 422 | Partial update only |
| DELETE | /v2/devices/{deviceId} | Deactivate device | 204, 404 | Soft delete — triggers workflow |
| GET | /v2/devices/{deviceId}/usage | Get data usage history | 200, 404 | Sub-resource pattern |
| POST | /v2/orders | Create service order | 201, 400, 422 | Ordering system integration |
Interview Q&A — Click to Reveal Answers
PATCH performs a partial update — only the fields you include are modified. More efficient for large objects like subscriber records where you only need to change one field.
Telecom example: A billing profile with 40 fields. Using PUT to change just the rate plan requires sending all 40 fields or risk nulling critical billing data. PATCH sends only
{"ratePlan": "IOT-5MB"}.
Idempotent: GET, PUT, DELETE, HEAD, OPTIONS
NOT idempotent: POST (each call creates a new resource)
Why it matters in telecom: If a network timeout causes a retry of a POST activation request, you could accidentally activate the same SIM twice — creating duplicate billing records. This is why ordering systems use idempotency keys:
X-Idempotency-Key: ORDER-2026-039471
403 Forbidden — Authentication succeeded but the authenticated user lacks permission. "I know who you are, but you can't do this." The client should NOT retry — the request will always be denied.
Telecom example: A service rep authenticated to the CRM (gets past 401) but tries to access billing financial records they don't have RBAC permission for → 403.
Approach:
1. Cross-reference the API schema against the actual system's business rule documentation or source code
2. Trace data flows end-to-end: ordering → provisioning → billing → compensation
3. Test all conditional branches — send requests with optional fields missing to see what fails downstream
4. Document contract deviations — "Field X is marked optional in schema but mandatory when account type = CORPORATE"
Real example from AT&T: fleetId optional in schema, mandatory for fleet billing accounts. Schema validation passes at 201, billing rejects at invoice generation → defect found 30 days later during billing cycle.
SOAP uses XML envelopes with strict WSDL contracts, supports WS-Security standards, and has formal error handling via SOAP Faults. Still dominant in legacy BSS/OSS telecom systems.
In practice at AT&T/TEOCO: Legacy billing, provisioning, and switch control often run SOAP/XML interfaces (some going back to the 90s). New IoT and CRM layers expose REST. The integration challenge is building adapters that translate between them while preserving field semantics, mandatory/optional logic, and data types.
Location header pointing to the new resource.Returning 200 OK instead of 201 is a common API design error. It means the consumer can't distinguish "this updated something" from "this created something new" just by the status code.
Why it matters in integration: If your middleware or monitoring is keying on 201 to trigger downstream workflows (like provisioning confirmation or billing initiation), getting 200 instead could cause those workflows to not fire — resulting in silent integration failures. This is the type of subtle defect this role is designed to catch.
1. Capture the correlation ID — every request should carry a correlation/transaction ID across all hops (X-Correlation-ID header or similar)
2. Establish the failure point — which system returned the error? Check each system's logs with the correlation ID
3. Reproduce in isolation — call the failing system's API directly with the same payload to confirm the error
4. Compare field values — field X in system A may be 20 chars, but system B has a 15-char constraint — data truncation causes silent failures
5. Check conditional field logic — a field that's optional in ordering may be mandatory in billing under certain account types
6. Validate schema vs actual — the published API schema may not match what the production system actually validates
Tools used: Splunk (correlation log search), Postman/curl (direct API calls), SQL queries against CRM/billing tables, Ansible runbooks for remediation