When calling REST endpoints, ensure the client request/response payload exactly matches the endpoint’s wire contract—especially when GET and PUT/PATCH shapes differ (nested ARM-canonical vs flat service payload) or when envelope fields must be consistent.
Actionable rules:
properties, construct the PUT payload explicitly (or use the dedicated create/update operation that matches the PUT contract).properties.<field> vs top-level). If your SDK model moved fields under .properties, update payload mapping accordingly.serverFarmId) in every envelope.mediaType; parse from response content-type when possible.additional_properties) once the typed model is migrated.Example (avoid generic-update for asymmetric shapes):
# Bad: generic-update typically does GET -> modify -> PUT
# but PUT expects flat { latestScan, results } while GET returns
# { properties: { latestScan, results } }, leading to 400 UnsupportedProperties.
# Good: call the endpoint that matches the PUT contract, or build
# the exact PUT payload shape explicitly.
put_payload = {
"latestScan": command_args.get("latest_scan"),
"results": command_args.get("results"),
}
# send put_payload directly to the baselineRules/{ruleId} PUT endpoint
Use this as a checklist before wiring a new operation or refactoring payload mapping: verify the exact request body shape (nesting + field names) against the endpoint’s spec, and don’t assume the SDK model shape equals the service’s accepted wire shape.