Posts

Showing posts with the label REST API

GraphQL vs. REST API: Context, Comparison, and Practical Use Cases

Image
APIs are the foundation of modern application integration. They allow web applications, mobile apps, cloud platforms, and enterprise systems to exchange data without exposing their internal implementation. For many years, REST has been the default approach for designing web APIs. It is simple, familiar, and supported by almost every modern technology platform. GraphQL introduced a different model, giving clients more control over the data they request. The decision between GraphQL and REST should not be based on which technology is newer. It should be based on the structure of the data, client requirements, performance expectations, operational complexity, and long-term maintainability. This article explains the context behind both approaches, compares their architectural characteristics, and identifies the situations where each one is most effective. What Is a REST API? REST, or Representational State Transfer, is an architectural style for building network-based applications. ...

Introducing Apex REST APIs as Agent Actions in Salesforce

Image
Please visit here for more details - https://ayaninsights.com/guestblogs/apex-rest-apis-as-agent-in-salesforce/ In this blog, I explore how Salesforce developers can transform existing Apex REST APIs into Agentforce actions, allowing AI agents to use custom business logic directly within Salesforce. The article begins with an introduction to OpenAPI, a standard format used to describe REST APIs in a machine-readable structure. An OpenAPI document defines available endpoints, supported operations, required inputs, response formats, and expected behavior. I also explain the differences between YAML and JSON, the two common formats used for creating these API specifications. The blog then covers Apex REST APIs and how developers use annotations such as @RestResource , @HttpGet , @HttpPost , @HttpPut , and @HttpDelete to expose custom Salesforce functionality as REST endpoints. I walk through the process of generating an OpenAPI document from an Apex REST class using Agentforce for Develo...

Authenticate using the SOAP login request

Login using the SOAP login request and from then on use the session token for making REST API requests.In this we need to pass Username and Password as credentials.Upon invocation, the API authenticates the credentials . It then returns the  sessionId , the user ID associated with the logged-in username, and a URL that points to the Lightning Platform API to use in all subsequent API calls.If Salesforce returns a Login fault , try adding the security token at the end of the user’s password.  The limit is 3,600 calls to login() per user per hour. Exceeding this limit results in a “Login Rate Exceeded” error. After reaching the hourly limit, Salesforce blocks the user from logging in. Users can try to log in again an hour after the block occurred. Sample Code -             HTTPRequest request = new HTTPRequest();             String username = 'rpatnaik@docmation.com';            ...

Salesforce EntityDefinition

Image
EntityDefinition Provides row-based access to metadata about standard and custom objects. EntityDefinition Note EntityDefinition fields are exposed in SOAP API version 45.0 and later. You can use Tooling API to query for EntityDefinition fields in guest user mode in API version 44.0 and earlier. In API version 45.0 and later, use SOAP API to get this data in guest user mode. EntityDefinition is still exposed in Tooling API to User Profiles with the ViewSetup permission.

Overview of Salesforce Apex REST and SOAP APIs:

Salesforce provides two primary mechanisms for integrating with external systems: REST (Representational State Transfer) and SOAP (Simple Object Access Protocol) APIs. Both REST and SOAP APIs allow you to interact with Salesforce data and metadata programmatically, including querying, creating, updating, and deleting records. Here's an overview of Salesforce Apex REST and SOAP APIs: Apex REST (RESTful Web Services): Description: Apex REST allows you to expose custom RESTful web services within Salesforce. You can define custom REST endpoints using Apex classes and methods, which can then be invoked by external systems using HTTP requests. Usage: Apex REST is well-suited for building lightweight, stateless APIs that adhere to RESTful principles. It's commonly used for integrating with mobile applications, external web services, and other systems that communicate over HTTP. Authentication: Apex REST supports various authentication mechanisms, including OAuth 2.0, Session ID, and ...