REST Fundamentals Patterns

REST API patterns I’ve actually used. Every entry has a date and context.

2026-03-18: ISE ERS Requires Accept AND Content-Type Headers

Problem: ISE ERS API returns XML by default. Curl requests returned XML even when expecting JSON.

Context: netapi development, ISE ERS integration

The Fix:

# WRONG: missing headers, returns XML
curl -k https://ise-01.inside.domusdigitalis.dev:9060/ers/config/endpoint

# RIGHT: explicit JSON headers
curl -k -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -u "$ISE_API_USER:$ISE_API_PASS" \
  https://ise-01.inside.domusdigitalis.dev:9060/ers/config/endpoint

Rule: ISE ERS requires both Accept and Content-Type headers set to application/json. Without them, you get XML or 415 errors.

Worklog: WRKLOG-2026-03-18


2026-03-20: PUT vs PATCH — Full Replace vs Partial Update

Problem: Used PUT to update a single field on an ISE endpoint, but PUT replaced the entire object and wiped other fields.

Context: ISE ERS endpoint update via netapi

The Fix:

# PUT replaces the ENTIRE resource
curl -k -X PUT \
  -u "$ISE_API_USER:$ISE_API_PASS" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  <a href="https://ise-01.inside.domusdigitalis.dev:9060/ers/config/endpoint/{id}" class="bare">ise-01.inside.domusdigitalis.dev:9060/ers/config/endpoint/{id}</a> \
  -d '{"ERSEndPoint": {"name": "new-name"}}'
# Result: all other fields reset to defaults!

# For partial updates, include ALL existing fields in the PUT body
# ISE ERS does not support PATCH — read first, modify, write back

Rule: ISE ERS only supports PUT (full replace), not PATCH. Always include all existing fields when updating. Read first, modify, write back.

Worklog: WRKLOG-2026-03-20