Interview Questions on REST API Integration in Salesforce (with Answers) | REST API Scenario-Based Interview Questions Salesforce

438 views

Interview Questions on REST API Integration in Salesforce (with Answers)

  • Q1. What is a REST API in Salesforce?

    REST API in Salesforce is a way to interact with Salesforce data using HTTP methods like GET, POST, PATCH, and DELETE. It allows external applications to connect with Salesforce and exchange JSON or XML data in a lightweight and efficient manner.

  • Q2. What is the difference between REST API and SOAP API in Salesforce?

    • REST API: Lightweight, uses JSON/XML, faster, good for mobile/web apps.
    • SOAP API: More complex, uses XML-based messaging, supports strict contracts (WSDL).

    πŸ‘‰ Use REST for simple, real-time integrations. Use SOAP for enterprise-level, structured integrations.

  • Q3. What are the authentication methods used in Salesforce REST API?

    Salesforce REST API uses OAuth 2.0 authentication.

    • Username-password flow (for server-to-server integrations).
    • Web server flow (for web apps).
    • JWT bearer flow (for secure server apps).
    • User-agent flow (for mobile apps).
  • Q5. Can you explain a real-world use case of REST API in Salesforce?

    Example: An e-commerce website uses Salesforce REST API to sync orders. Whenever a customer makes a purchase, the order details (items, payment status, delivery info) are automatically updated in Salesforce. This ensures sales teams have real-time data.

  • Q4. How can you test REST API in Salesforce?

    You can test Salesforce REST API using tools like Postman, cURL, or directly in Apex code. Salesforce also provides a tool called Workbench for testing REST API calls.

  • Q6. What are common HTTP methods used in REST API with Salesforce?

    Salesforce REST API uses OAuth 2.0 authentication.

    • GET β†’ Retrieve data
    • POST β†’ Create new records
    • PATCH β†’ Update records
    • DELETE β†’ Remove records
  • Q7. What are some common challenges in Salesforce REST API Integration?

    Salesforce REST API uses OAuth 2.0 authentication.

    • Authentication issues with OAuth tokens
    • API request limits (Governor limits and daily API limits)
    • Handling large data sets (use Bulk API instead)
    • Error handling (401 Unauthorized, 403 Forbidden, etc.)
  • Q8. What are Salesforce API limits?

    Each Salesforce org has daily API request limits, based on the edition and number of licenses. For example, Enterprise Edition allows 100,000 API requests per day. Always design integrations to avoid hitting limits.

  • Q9. How do you handle large data in Salesforce REST API?

    For large data sets, use:

    • Batching in REST API
    • Composite REST API (for multiple requests in one call)
    • Bulk API (for millions of records, asynchronous processing)
  • Q10. How do you secure REST API Integration in Salesforce?

    • Use OAuth 2.0 authentication
    • Always store tokens securely
    • Enable IP whitelisting
    • Use Named Credentials in Salesforce for managing external endpoints
  • Q1. What is the difference between REST API and SOAP API in Salesforce?

    REST API is lightweight, uses JSON, and is ideal for mobile/web apps. SOAP API is heavier, uses XML, and is better for complex enterprise-level integrations.

  • Q1. Why do we use REST API in Salesforce?

    It allows external applications to securely access and manipulate Salesforce data without requiring direct database access.

  • Q1. What data formats are supported in Salesforce REST API?

    Salesforce REST API supports JSON (most common) and XML.

  • Q1. What are the common HTTP methods used in REST API?

    GET (Retrieve), POST (Create), PUT/PATCH (Update), DELETE (Remove).

  • Authentication and Security

  • Q1. How do you authenticate REST API calls in Salesforce?

    Using OAuth 2.0 or Session ID. OAuth 2.0 is the recommended secure method.

  • Q1. What is OAuth 2.0 in Salesforce REST API?

    It’s a secure authentication framework where the client app gets an access token to make API calls.

  • Q1. What are the OAuth 2.0 flows supported by Salesforce?

    Authorization Code Flow, Username-Password Flow, JWT Flow, and Client Credentials Flow.

  • Q1. What is a Named Credential in Salesforce?

    Named Credential is a feature in Salesforce to securely store API authentication details (like endpoint and tokens).

  • Q1. Why are Named Credentials better than hardcoding credentials?

    They provide security, centralized management, and easier maintenance.

  • CRUD Operations

  • Q1. How do you create a record using REST API in Salesforce?

    Use the POST method with endpoint /sobjects/ObjectName/. Example: /sobjects/Account/.

  • Q1. How do you retrieve a record using REST API?

    Use the GET method with endpoint /sobjects/ObjectName/Id.

  • Q1. How do you update a record using REST API?

    Use the PATCH method with endpoint /sobjects/ObjectName/Id.

  • Q1. How do you delete a record using REST API?

    Use the DELETE method with endpoint /sobjects/ObjectName/Id.

  • Q1. Can you perform SOQL queries with REST API?

    Yes, using /query/?q=SOQL_Query..

  • Integration Scenarios

  • Q1. How do you call an external REST API from Salesforce?

    Using Apex HTTP classes (Http, HttpRequest, HttpResponse) and optionally Named Credentials.

  • Q1. How do you expose Salesforce data as a REST API to external systems?

    By creating a custom Apex REST class with @RestResource annotation..

  • Q1. What are common real-world use cases of REST API in Salesforce?

    Payment gateway integration, CRM to ERP data sync, external mobile app integration, marketing automation.

  • Q1. How do you send JSON data from Salesforce REST API?

    By setting request body format to application/json in Apex HTTP callouts.

  • Q1. How do you receive JSON data in Salesforce REST API?

    Salesforce automatically deserializes JSON into sObject fields or Apex classes.

  • Error Handling & Best Practices

  • Q1. What error codes are common in Salesforce REST API?

    400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 500 (Internal Server Error).

  • Q1. What should you do if you hit API limits in Salesforce?

    Use Bulk API for large data loads, optimize queries, or request higher limits.

  • Q1. How do you debug REST API issues in Salesforce?

    Use Debug Logs, Postman tool, and Developer Console.

  • Q1. How do you handle authentication token expiration in REST API?

    Refresh the token using OAuth Refresh Token flow.

  • Q1. What is the difference between Composite API and Batch API?

    Composite API executes multiple requests in a single call (dependent). Batch API groups independent requests.

  • Advanced & Practical Questions

  • Q1. Can REST API handle large data volumes in Salesforce?

    Not efficiently. For large volumes, use Bulk API.

  • Q1. What is the role of Connected Apps in REST API integration?

    Connected App defines OAuth policies and allows external systems to connect securely.

  • Q1. How do you secure sensitive data in REST API integration?

    Use Named Credentials, OAuth 2.0, field-level security, and encryption.

  • Q1. What is the rate limit for Salesforce REST API calls?

    Depends on the edition, but usually 15,000 to 1,000,000 API calls per 24 hours.

  • Q1. What are some best practices for REST API integration in Salesforce?

    • Use OAuth 2.0 for authentication
    • Use Named Credentials
    • Handle API limits
    • Use retry logic for failures
    • Follow JSON best practices

 

FAQ (Frequently Asked Questions)

What are the 4 types of REST API?

The four types of REST APIs are GET (retrieve data), POST (create data), PUT (update data), and DELETE (remove data).

What is the function of REST API in Salesforce?

You can use REST API tools to create, manipulate, and search data in Salesforce by sending HTTP requests to endpoints in Salesforce. Depending on where you send requests, you access and operate on different pieces of information, called resources. Resources include records, query results, metadata, and more.

What is rest API integration?

REST API integration, or REST integration, simply involves connecting applications via their REST APIs. This can be implemented in-house or through a 3rd-part solution (e.g. an integration platform as a service).

πŸ‘‰ Get Complementary β†’

right side banner -- www.w3webmart.com
 
  
πŸ‘‰ Get Free Course β†’

πŸ“Œ Salesforce Administrators

πŸ“Œ Salesforce Lightning Flow Builder

πŸ“Œ Salesforce Record Trigger Flow Builder

πŸ‘‰ Get Free Course β†’

πŸ“Œ Aura Lightning Framework

πŸ“Œ Lightning Web Component (LWC)

πŸ“Œ Rest APIs Integration



Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net