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
0answers
10 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
0answers
34 views

Expose an Apex method as a REST resource and respond after multiple api calls from Process Builder

I am working on Automated Salesforce integration project where in I am creating a case after exposing an Apex method as a REST resource - 1 https://abcdef.my.salesforce.com/services/apexrest/...
0
votes
1answer
20 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 ...
-2
votes
0answers
22 views

Exception while uploading file from salesforce to amazon s3 bucket

I wrote the below code for backing up the attachments from salesforce to Amazon S3. I created a bucket and folder in S3 and made them public. While executing the below code, I am getting the below ...
0
votes
0answers
25 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
49 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
22 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.
3
votes
1answer
43 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
45 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
24 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
53 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
45 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
23 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
33 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
41 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
52 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
66 views

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

Can we make API calls in 'start' method of batch class ?
-2
votes
1answer
28 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
26 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
145 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
23 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
52 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
90 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
16 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
39 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
73 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
20 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
25 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
86 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
43 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
33 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
32 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: ...
1
vote
1answer
66 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
23 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
37 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 ...
0
votes
0answers
29 views

How to reset apex code on scratch org on source:push?

I am working on some custom apex code and I have stumbled on a problem: I have a class, for example: class Test { public static String CONST1 = "test1"; public static String CONST2 = &...
2
votes
1answer
106 views

Help Understanding How to write Test Class for Apex HTTP Post

So I've been through quite a few posts/questions already looking for enough information to have this "click" for me, but I'm still missing something. This is my first time working with ...
1
vote
1answer
101 views

Unsupported grant type when getting an access token for a Connected App from Jira but not from curl [closed]

Doing the following using curl works... curl "https://test.salesforce.com/services/oauth2/token" \ --data 'grant_type=password&client_id=CONSUMER_KEY&client_secret=CONSUMER_SECRET&...
1
vote
1answer
137 views

Exposing an APEX REST endpoint to be called by Jira

Built an APEX REST endpoint that handles an inbound PUT operation to update records in an SObject (Time_Entry__c). I want to trigger the PUT from a Jira Automation with a web request whenever a ...
0
votes
2answers
48 views

How “NextStartDate” field value get calculated for DatedConversionRate object

I would like to know how the calculation is happening for DatedConversionRate's nextstartdate, is it depends on some configuration setting?
0
votes
1answer
101 views

How to get OAuth 2-based authenticated access to REST APIs in a Lightning Community

I am trying to get (custom, Apex-based) REST API access for a (lightning) community user but keep hitting an error around access to the REST API's apex implementation. The specific error is: You do ...
2
votes
1answer
391 views

Special Characters in rest API URL

Is there any way to handle a & in a params being sent in the URL of a restAPI call. So that the system doesn't think this the end and start of a different params? The URL being sent is below: /...
1
vote
1answer
155 views

why POST request on POSTMAN always respond with 405?

In salesforce apex, I have one custom API, It's working fine on the workbench but not work on POSTMAN, I have an access token, this works fine with GET method, but why not work with POST in POSTMAN? ...
2
votes
1answer
52 views

My test class (not annotated seeAllData=true) actually sees data for ContentNote SObject

I know test methods should not see any data except the data created in test context, but when I run the test below, the query returns an org record. It should not I have a REST class like @...
0
votes
0answers
105 views

Session expired or invalid on using access token

I have created a connected app in which I have selected the OAuth Scopes "Access and manage your data (api)" and "Full access (full)" through the consumer key and consumer secret ...
3
votes
2answers
842 views

How I can know who is calling a REST resource?

We have the following REST endpoint @RestResource(urlMapping='/multi/v1/Contact/ContactId__c/*') global with sharing class ContactMultiV1 { @HttpPost global static MultiV1.SuccessResponse[] post(...
0
votes
1answer
88 views

Getting invalid header line: “SFDC_STACK_DEPTH: 1” error

While posting a HTTPs request through apex I am getting below intermittent error . *64545242 client sent invalid header line: "SFDC_STACK_DEPTH: 1" while reading client request headers, ...
0
votes
1answer
45 views

Sending PDF file from Salesforce to XERO, but it's not happening

I want to send PDF file which is generated by VF page from Salesforce to XERO. But I'm trying to send but it's not happening XERO syntax, it receives like below format POST /api.xro/2.0/Receipts/...
10
votes
1answer
934 views

Custom REST controller to access Auth.AuthToken.getAccessToken returning null

Following on from a previous question: How to access OAuth Token stored in NamedCredential using Apex for use in other third party application I've created a custom REST endpoint which proxies ...

1
2 3 4 5
11