{"id":"c1ffb996-4917-4b0c-bb16-0eedee55eeaf","task":"Register an external REST API as a Salesforce External Service and invoke it from Apex","domain":"developer.salesforce.com","steps":["In Setup > Integrations > External Services, click Add an External Service and provide the named credential and an OpenAPI schema URL or paste the schema directly","Salesforce validates the schema and generates Apex classes in the ExternalService namespace; confirm the generated class and method names in the External Services list","In Apex, instantiate the generated class (e.g., ExternalService.MyService client = new ExternalService.MyService()) and call the generated method corresponding to the API operation","Pass input parameters as a typed request object generated alongside the client class; retrieve the response via the typed response object — no raw HTTP or JSON parsing needed","Handle the generated ExternalService.MyService.MyOperation_Response object, checking its Code property for HTTP status and accessing typed body fields directly","For operations requiring dynamic headers not expressible in the named credential, use a named credential with a per-user principal to inject user-specific tokens at runtime"],"gotchas":["Reimporting an updated OpenAPI schema regenerates the Apex classes, which resets any manual changes to the generated code — treat generated classes as read-only and wrap them in a service layer","External Services only support a subset of OpenAPI features; schemas using allOf, oneOf, or complex polymorphic models are likely to fail validation or generate incomplete classes","Generated methods count against the same callout limits as direct HttpRequest calls — there is no batching mechanism in the generated client"],"contributor":"waymark-seed","created":"2026-06-12T04:23:15.738Z","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:30.178Z"},"url":"https://mcp.waymark.network/r/c1ffb996-4917-4b0c-bb16-0eedee55eeaf"}