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
0 votes
0 answers
17 views

what are the risks of passing external id in patch url of inbound callout to salesforce from external system using standard Rest API?

We are creating a connection to external system. For this we are not using custom webservice instead using the Salesforce standard Rest API by using its functionality of Patch by passing the external ...
user avatar
-2 votes
0 answers
30 views

Unable to resolve host "na111.salesforce.com": No address associated with hostname

I'm doing a callout to salesforce from my external system and getting this error. I checked the instance status and it looks fine in trust.salesforce.com The external system from where I'm doing this ...
user avatar
1 vote
0 answers
45 views

Unable to Set Response Headers in Abstract or Extended Class

I am trying to set the Content-type header to application/json on REST response in apex and no matter where I set it, it always returns application/octetstream. I am using an abstract base class. When ...
user avatar
-1 votes
1 answer
29 views

Can we pass Name as a parameter like below for the PUT method in Rest API [closed]

Can we pass Name as a parameter like below for the PUT method and perform the update operation. The external system does not recognize the Salesforce record Ids. the external system will pass the name ...
user avatar
-1 votes
0 answers
13 views

Can not update Task/Activity record through apex

We have Activity Object set as Private in organization wide defaults. Due to which we can't update Task/Activity records through apex even after using without sharing. Is there a way to achieve it ...
user avatar
3 votes
1 answer
44 views

File corrupted on sending data to create file via workbench using REST API

I am trying to create a file in in salesforce via workbench. The file is getting created although the file is corrupted. I feel there is some issue in binary data. What I am doing to get the binary ...
user avatar
  • 51
0 votes
1 answer
43 views

Apex Callout Issue - System.HttpResponse [Status=Moved Permanently, StatusCode=301]

I am trying to make a callout to an open public api. When I tested it on Postman, it is giving me the expected response. But when I tried it on the Apex class, the response is giving me the following ...
user avatar
  • 35
-1 votes
1 answer
64 views

is it possible to add uri parameters on a http callout using named credentials?

Context: I have to call, from a source org, a HttpGet method from a target org. This method will return a list of records that match a certain value on a field, which I have to send from my source org....
user avatar
-3 votes
1 answer
66 views

Consuming salesforce Rest API with out security token [closed]

I am exposing a API in salesforce which will be hit by an external c# application. I am enabled oAuth mechanism. Things are looking good but when the external end point needs to pass user id and ...
user avatar
  • 59
2 votes
1 answer
68 views

How to generate and send a PDF via REST API Request

This is a follow-up new question to This SE Is it possible to create a custom REST API Class to allow an oAuth connected app client to download a dynamically generated PDF visualforce page via REST ...
user avatar
0 votes
0 answers
23 views

CSRF token for external system callout

I am new to salesforce development. I have a API consume apex class where I call an external system using GET method (Rest API) The external system doesn’t have any anti CSRF implementation Will ...
user avatar
-2 votes
2 answers
84 views

How to create endpoint url in salesforce org to use in rest resource [closed]

Rest Api. I wanna to create a link to be able to get api calls @RestResource(urlMapping = '/GetByDate/*') global class RetutnLeadsByDateRestResource { @HttpPost global static void ...
user avatar
0 votes
1 answer
52 views

How to get the number of objects I received in JSON response?

How can I count the number of objects I received in JSON response? In the below response I got two objects (id:1234, id:2345) and I want a variable that shows the total number of objects received in ...
user avatar
  • 49
-2 votes
1 answer
26 views

Add two values that return from API

I'm going to be calling a REST endpoint to return back data for two datapoints into a lightning component in SF. This is only needed from a UI standpoint visually on the lightning component. This may ...
user avatar
0 votes
1 answer
40 views

Is it possible to expose a webservice from lwc in Salesforce? [closed]

I want to make a REST api call to show notification or toast message in the lwc. I have tried with Platform Events and Change Data Capture. Is there any way to receive the REST API call in the lwc so ...
user avatar
0 votes
1 answer
774 views

Apex REST API GET method with request body?

How do you do a HttpRequest for a GET method with a request body? For some reason this GET method is getting converted to POST and is not successful. This is working via postman. Http http = new Http(...
user avatar
  • 372
0 votes
0 answers
126 views

Salesforce to Salesforce REST api integration to same org fails with 401 Unauthorized

The salesforce Field Service Developer Guide has this snippet of APEX designed to make a same-org REST call: String salesforceHost = System.Url.getSalesforceBaseURL().toExternalForm(); String url = ...
user avatar
  • 293
1 vote
1 answer
131 views

what would be the best way to insert bulk data to a custom object

I need to make 2 calls per day to API Rest and process the data. I have used “apex scheduler” to automate the 2 calls a day, then call to my apex class where I have all the logic to call the ...
user avatar
-1 votes
2 answers
112 views

Record is only update from API [closed]

The record which came from Rest API should only update from API, no user can update the record manually. for(Opportunity guestuser: trigger.new) { id currentuser = guestuser.CreatedById; ...
user avatar
3 votes
1 answer
201 views

Check if apex is being run in Rest Resource

Is there a way to check if being run in RestResource Context? I have a script that posts messages to an endpoint but we can end up in an infinite loop scenario as they are now posting their comments ...
user avatar
-1 votes
1 answer
83 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 ...
user avatar
0 votes
1 answer
68 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; ...
user avatar
1 vote
0 answers
87 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 ...
user avatar
0 votes
0 answers
135 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 ...
user avatar
  • 2,339
-1 votes
1 answer
69 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 ...
user avatar
-1 votes
2 answers
438 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/...
user avatar
  • 101
0 votes
1 answer
31 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??
user avatar
2 votes
1 answer
537 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 ...
user avatar
0 votes
0 answers
18 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 ...
user avatar
3 votes
2 answers
1k 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/...
user avatar
0 votes
1 answer
117 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/...
user avatar
  • 357
-1 votes
1 answer
127 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 ...
user avatar
0 votes
0 answers
107 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.
user avatar
  • 1
1 vote
1 answer
1k 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[...
user avatar
  • 113
0 votes
0 answers
50 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) ...
user avatar
0 votes
1 answer
64 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 ...
user avatar
0 votes
0 answers
92 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 ...
user avatar
  • 13
0 votes
1 answer
101 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 ...
user avatar
  • 771
0 votes
0 answers
220 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 ...
user avatar
2 votes
1 answer
647 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 ...
user avatar
0 votes
1 answer
110 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.
user avatar
4 votes
1 answer
317 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 ...
user avatar
2 votes
1 answer
388 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 ...
user avatar
  • 625
0 votes
1 answer
112 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 ...
user avatar
0 votes
2 answers
560 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({ ...
user avatar
2 votes
1 answer
115 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 ...
user avatar
  • 2,450
1 vote
1 answer
364 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 ...
user avatar
  • 10.6k
2 votes
1 answer
39 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 ...
user avatar
0 votes
1 answer
470 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 ...
user avatar
0 votes
0 answers
46 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",&...
user avatar

1
2 3 4 5
12