Questions tagged [apexrest]

Apex REST enhances the Force.com REST API to allow developers to create custom REST-enabled web services using Apex.

Filter by
Sorted by
Tagged with
-1
votes
1answer
42 views

System.TypeException: Invalid decimal in Rest Resource @HttpPost

I developed an Apex REST web service in Salesforce with the method 'POST' and i am trying to insert the string value in currency field of Product__c object, so when I try to hit the API im getting the ...
0
votes
1answer
29 views

Help with TEST Class using @HttpGet [duplicate]

I have this simple little @HttpGet method. @HttpGet global static List<Case> getCases() { RestRequest req = RestContext.request; RestResponse res = RestContext.response; ...
1
vote
0answers
32 views

Resubmit API Callout from Queueable method

I am working on an assignment where I need to process some subscribed events in Salesforce when a third party system publishes an event. The third party system publishes an event when there is a ...
0
votes
0answers
50 views

How can Automated Process user get access to REST API class without having to change its Apex Class permissions in the profile?

We have a scenario where from a platform event handler (so user is Automated Process), we could be making a REST API callout to a class belonging to another managed package. Doing so leads to this ...
-1
votes
1answer
38 views

Most secure method of authentication for an API user? [closed]

We have a need for an external site to call services exposed from our Salesforce org via APEX REST. In previous projects I would leverage a connected app with username/password flow and create an API ...
-1
votes
2answers
176 views

REST API Call Not Working From Apex Class But Working on Postman

I am new to Salesforce and trying to learn calling external REST API from Apex class. I have a simple spring boot rest api running on my localhost:8080. API Endpoint : http://localhost:8080/api/...
0
votes
1answer
23 views

Is that we can send the multipart/form-data till 2GB by using rest api in apex

Is that multipart message is available in RestAPI in Apex 2021 to send the large files(till 2GB) from source org to target org??
1
vote
1answer
120 views

Why am I getting "Service not found error" when trying to access a @RestResource when it is exists?

I have a rest class with a @RestResource annotation and a method with @HttpPost annotation. Something like - (urlMapping='/abc/contractors') class ContractorInfoWebService { @HttpPost global ...
0
votes
0answers
17 views

I want to filter/check if feedItem/comments exist for a specific feedtype

When two users of same type open message window at same time and summited at different time, system creates two different threads of same type. But they are supposed to be in one thread. Scenario is I ...
2
votes
2answers
523 views

Is it possible to have multiple POST calls in the same Apex REST class?

I have a requirement to write a REST class to fetch different set of resources that need to be accessed through different endpoints. Eg. /services/apexrest/abc/contractors /services/apexrest/abc/...
0
votes
1answer
31 views

outbound message session id raises "This session is not valid for use with the REST API" error

I have an Outbound Message that is received by a php webserver. The session Id is extracted and as per https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/...
-1
votes
1answer
64 views

Using Salesforce as IDP for community plus users on an external company site?

I got tasked with these requirements I am kind of lost on. Was wondering if anyone here has had a similar ask or can provide suggestions for how to go about this? We have an external company website ...
0
votes
0answers
47 views

Integrate Salesforce with SFTP [duplicate]

How to integrate salesforce with SFTP through rest api? I need to send csv file to SFTP. Please suggest.
1
vote
1answer
622 views

Apex REST API call Error - HttpResponse[Status=Unauthorized, StatusCode=401]"|

I build an apex rest API that is returning base64 to client. API works fine with PostMan/soapUI. When i try to invoke same Apex REST API from my another developer Account I am getting HttpResponse[...
0
votes
0answers
29 views

initPasswordlessLogin throws "supported only for members logging in to an Experience Cloud site."

I have a REST endpoint that calls initSelfRegistration or initPasswordlessLogin if the user exists. The first one works as expected, but initPasswordlessLogin(communityUserId, verificationMethod) ...
0
votes
1answer
32 views

Solving issues of resSystem.HttpResponse[Status=Method Not Allowed, StatusCode=405]

Iam trying to use rest to retrive the files from one org to another org 1.To send the Id of the content version in opportunity from source org to target org 2.Target Org should get the id and store ...
0
votes
0answers
46 views

Named Credential Authentication Error

I am trying to connect with Named Credentials. I am using oAuth2.0 authentication protocol. I have created a connected app ,Auth Provider and Named credentials as shown in the image below Error, the ...
0
votes
1answer
61 views

Is multipart/form-data available for apex @RestResource classes

I have a class that retrieves a file in binary code from an external webservice call to our Salesforce and generates a file but now they want to change it to multipart/form-data. I've been reading the ...
0
votes
0answers
129 views

System.UserManagement.initSelfRegistration and System.UserManagement.verifySelfRegistration in apex rest?

We have a requirement where a user will be ask to register/verify on external website but we need to create a portal user for them and verify them using OTP sent in email. We know that methods like ...
1
vote
1answer
334 views

Access-Control-Allow-Origin Header Authentication Issue

I was trying to call OAuth from our website but it gives an error Access to XMLHttpRequest at 'https://.salesforce.com/services/oauth2/token' from origin 'https://***.com.ph' has been blocked by CORS ...
0
votes
1answer
43 views

Add field to report type with Apex or Salesforce REST API

I have a lot of custom report types (100+), adding a new/existing field to the report types is a tedious and manual process. I am looking for a Salesforce REST API or APEX snippet for doing the same.
4
votes
1answer
182 views

API login after MFA enforcement

With the enforcement of MFA coming next year, I've started to test an API I wrote for a client that allows their website to talk to Salesforce. It's working fine right now, but if I enable High ...
2
votes
1answer
208 views

How do I process application/x-www-form-urlencoded via a custom endpoint

I want to process a POST to a custom APEX REST endpoint that is being posted from SLACK with a Content type of application/x-www-form-urlencoded When I inspect the body of the post in Hookbin it ...
0
votes
1answer
47 views

Return Case Number After Insert a new Case

I've created an Apex Class which inserts new Case. On the tutorial it only returns the ID. I've checked and researched on how to return the CaseNumber value. But it gives me an error on when called on ...
0
votes
2answers
300 views

LWC showToast not working after apex callout

Hope all you are really well! (have just signup here) I have LWC which is nested in an Aura component. I'm calling imperatively an apex method which executes a REST call: createClientOnMoloni({ ...
2
votes
1answer
59 views

How to use Named credentials with a 2 step password and access token authentication system?

The third party system that I am trying to connect to has following authentication mechanism: Step 1: We have been provided with a X-Api-User and X-Api-Secret to be included in header. Other header ...
1
vote
1answer
109 views

Do Apex rest services methods like @HttpPost support Apex class object as parameter?

I am writing an Apex Rest Service with the POST Method. For that, I have written an apex class wrapper for the request. Like below. global class RestRequestWrapper { global String eId; global ...
2
votes
1answer
35 views

Simulate “with sharing” for specified user (in integration)

The need: An external system is querying SF data via an Apex REST API. It authenticates to SF via an integration user account (an M2M integration). We need the data returned by the API to be ...
0
votes
1answer
198 views

ERR_ABORTED 401 (Unauthorized) in LWC

I am working on the Salesforce pilot feature where I can't call @AuraEnabled methods from LWC. As an alternative to this, I have created a rest resource and I am calling the same rest resource to get ...
0
votes
0answers
38 views

Need Help - Getting Bad Request status = 400 in Rest API Integration

When I pass hardcode parameter in setbody so it gives me correct response. req.setBody('{"boothId": "100170","coId": "3","operatorId": "3",&...
0
votes
0answers
60 views

Apex REST - GET with body fails in Summer '21 release

Our sandbox got updated to Summer '21 release. Now sending any payload (body) to @RestResource via GET method returns this HTML We are down for maintenance. I can't find anything about it in the ...
1
vote
1answer
129 views

API calls in batch class's start method [closed]

Can we make API calls in 'start' method of batch class ?
-2
votes
1answer
31 views

Invocable Test Class

I'm trying to write test class for one of the Invocable class that calls another class, though the test passes but i don't think it is actually testing the code. Struggling to call list in test class ...
0
votes
1answer
34 views

Retrieve a list of Accounts via REST

I am using Postman to get all account records from salesforce. The below code is working for only one record @HttpGet global static Account doGet() { RestRequest req = RestContext....
0
votes
2answers
380 views

Connect SAP PI to Salesforce via OAuth and REST API - How get a everlasting Bearer Token [closed]

I am fairly new to REST API and the OAuth stuff ... so my question might be somewhat silly. However... We want to call a Salesforce REST API that's coded in an APEX class from SAP PI. A proof of ...
0
votes
0answers
31 views

Create Dynamic Trigger from Managed Package

I want to create a trigger based on user's input after they install my managed package. Can anybody please explain in detail on what are the possible solutions for this? I did look at one solution: ...
0
votes
0answers
102 views

How to change endpoint for HTTP callout to an apex rest endpoint?

I have an external endpoint that is being called from one of my sandboxes. I will not be able to use the endpoint in the new sandbox due to limitation on the external endpoint that prevents additional ...
0
votes
1answer
231 views

Error while executing query for custom fields using Tooling API

I am trying to get all the custom fields, but on using the tooling API through APEX am getting the below error APEX Code : String baseURL = URL.getSalesforceBaseUrl().toExternalForm()+'/services/...
0
votes
0answers
24 views

How to check and set Rest Call Timeout?

my query is timing out, I got info from the documentation that max timeout can be 120 sec and min is 10 second. How to check and set the new timeout limit?
2
votes
1answer
45 views

JSON Deserializing List Issue

We have been receiving JSON updates from one of our third parties for updates on deliveries, and they bulkify them in batches of up to 100 updates (example below). { "item": [ { &...
1
vote
1answer
139 views

Extracting Salesforce Id from a Lightning URL in an Apex REST endpoint

Creating an Apex REST endpoint to receive updates for Opportunities. The caller of the endpoint will send the full Lightning URL for an Opportunity. For example: https://example.lightning.force.com/...
0
votes
1answer
21 views

HTTP Rest URL considering + as concatination

I'm trying to send http request as below- /services/apexrest/ContactSearch?contactNumber=+(734)-122345&VIPCheck=false I'm receiving contactnumber as (734)-122345. But i'm expecting +(734)-122345. ...
0
votes
0answers
36 views

Rich Text And Images In VisualForce

If i create a richText inside of a visualforce page and i paste a screenshot inside the rich text box . Is it Possible to bind the whole rich text content to a 'string ' in the controller, Will the ...
0
votes
1answer
158 views

LWC: JS based Integration or apex based rest integration, which is better and why?

In LWC, what are the pros and cons of doing integration directly from JS (with help of methods such as fetch) when compared with normal apex based rest integration? Please consider the situations of ...
0
votes
0answers
200 views

How to retry the callout on http request timed out in rest apex callouts? [duplicate]

Below is the code. Can anyone tell how to implement retry logic when the 2 minutes http request get timed out. public static void sendOptyInfo(Set <Id> oppIdSet) { try{ for (...
-1
votes
1answer
88 views

How to delete records automatically and periodically , object cases? [duplicate]

I couldn't find a way to delete records from the case object automatically periodically with code apex please help me with this.
0
votes
0answers
38 views

How to call salesforce restwebservice from Browser

I have exposed an apex class as rest and i want to execute this in google chrome. Im using the below url https://instanceurl.my.salesforce.com/services/apexrest/getAccountTest/ im getting this error: ...
2
votes
1answer
177 views

Generate Swagger JSON for an Apex REST API?

I've been finding documentation on how Salesforce can utilize API JSON generated by Swagger to generate code and implement APIs that way, but what I haven't been able to find is if it is possible to ...
0
votes
0answers
31 views

Create new lead Record with Lead custom field & relationship using SF REST API

I have a Lead object with some set of fields. I have created one custom Lead field & relationship with data type Lookup(Lead) which is Interested. I am using below REST API & format to create ...
0
votes
1answer
75 views

Creating duplicate leads via API calls

I have a rest API endpoint in Salesforce which accepts a payload from my application. On reception of the first request with a given email, it creates a lead. On subsequent requests, it finds the lead ...

1
2 3 4 5
11