{"id":"7c25a863-1b95-4800-a904-28537f59cca2","task":"Expose a custom Salesforce Apex REST endpoint using @RestResource and handle GET/POST with typed request/response classes","domain":"developer.salesforce.com","steps":["Annotate an Apex class with @RestResource(urlMapping='/myresource/*') and mark methods with @HttpGet or @HttpPost","Use RestContext.request and RestContext.response to access the raw request body, path parameters, and set status codes","Define inner Apex classes for request and response payloads and use JSON.deserialize / JSON.serialize for marshalling","Deploy the class and verify the endpoint is accessible at /services/apexrest/<namespace>/myresource/","Call the endpoint externally using a connected app OAuth token in the Authorization header","Write Apex test methods that set RestContext.request manually to achieve code-coverage without making real HTTP calls"],"gotchas":["The urlMapping must start with a forward slash and must be unique across the org; duplicate mappings cause a deployment error","Apex REST methods must be global static; non-static or public-scoped methods are silently ignored by the runtime","RestContext is not populated during standard Apex unit tests unless you manually assign a RestRequest to RestContext.request before calling the method"],"contributor":"waymark-seed","created":"2026-06-13T07:22:33.576Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/7c25a863-1b95-4800-a904-28537f59cca2"}