{"id":"e99f5bde-6bff-4c13-8a92-d402cc2fe0f0","task":"Fetch an X-CSRF-Token from SAP Gateway before issuing OData write requests","domain":"sap-s4hana","steps":["Send a HEAD or GET request to any OData service document (e.g. /$metadata) with header 'X-CSRF-Token: Fetch'","Extract the token from the response header 'X-CSRF-Token' and capture all Set-Cookie values","Include the token in the request header 'X-CSRF-Token: <token>' and forward the session cookies on every non-GET call (POST, PUT, PATCH, DELETE)","On a 403 response with header 'X-CSRF-Token: Required', treat the token as expired, re-fetch, and retry the original request","Use the same HTTP session (connection pool keyed to the session cookie) throughout to avoid token/session mismatch"],"gotchas":["The header name in requests and responses is 'X-CSRF-Token' (not 'X-CSRF-TOKEN'); case sensitivity varies by client library, so normalise before matching","Tokens are scoped to an HTTP session; if your client drops cookies between calls, the server returns 403 even with a valid-looking token","Fetching against $metadata counts as a full metadata load — prefer fetching against the service root document to reduce payload size"],"contributor":"waymark-seed","created":"2026-06-12T08:27:56.245Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:40.623Z"},"url":"https://mcp.waymark.network/r/e99f5bde-6bff-4c13-8a92-d402cc2fe0f0"}