Courseiva

SF-PD2 Process Automation, Logic, and Integration Practice Question

A developer is creating a REST API endpoint in Salesforce that external systems will call to create Case records. The external system sends a JSON payload with a custom header 'X-API-Key' for authentication. The developer needs to validate this key against a custom setting before processing the request. Which Apex class should the developer use to implement this endpoint?

⚠ Common exam trap

Many candidates confuse asynchronous processing interfaces with the mechanism for exposing REST endpoints, which requires the @RestResource annotation.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

A class annotated with @RestResource(urlMapping='/Cases/*')

The correct approach is to use a class annotated with @RestResource and a URL mapping. This exposes the Apex class as a REST endpoint. The developer can then define a method with @HttpPost to handle incoming POST requests, validate the 'X-API-Key' header against a custom setting, and create Case records. Other interfaces like Schedulable, Batchable, or Queueable are for asynchronous processing and do not provide REST endpoints.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    A class that implements the Queueable interface

    Why it's wrong here

    The Queueable interface is used for asynchronous Apex jobs that can be chained and run in the background. It does not expose an HTTP endpoint. While Queueable can be used to process the request asynchronously after receiving it, the endpoint itself must be defined using @RestResource. This interface is for asynchronous processing, not for handling incoming REST calls.

  • ✗

    A class that implements the Schedulable interface

    Why it's wrong here

    The Schedulable interface is used for scheduling Apex jobs to run at specific times, not for creating REST endpoints. Implementing Schedulable would not allow external systems to call the class via HTTP. It is designed for asynchronous batch processing on a schedule, not for handling incoming REST requests. This interface is unrelated to the requirement.

  • ✓

    A class annotated with @RestResource(urlMapping='/Cases/*')

    Why this is correct

    To create a REST API endpoint in Salesforce, you define a class with the @RestResource annotation and specify a URL mapping. Inside, you define methods annotated with @HttpPost, @HttpGet, etc., to handle HTTP requests. This allows external systems to call the endpoint. The developer can then validate the 'X-API-Key' header in the method and process the request.

  • ✗

    A class that implements the Database.Batchable interface

    Why it's wrong here

    The Database.Batchable interface is used for batch Apex jobs that process large data sets asynchronously. It does not provide a REST endpoint. While batch Apex can be invoked from a REST endpoint, the endpoint itself must be defined in a class annotated with @RestResource. This interface is for data processing, not for exposing a web service.

About these practice questions

Courseiva writes every SF-PD2 question from scratch — 226 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Salesforce exam blueprint

This SF-PD2 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SF-PD2 exam.