Skip to main content

Questions tagged [restresource]

Filter by
Sorted by
Tagged with
0 votes
0 answers
32 views

Not able to hit restresource URL from LWR community site

Issue: From my LWR community I am not getting the output from the restresource URL I created one rest resource like as below code. PS: I commented all my original logic and just trying with some test ...
SFDC-Beginner's user avatar
-1 votes
3 answers
91 views

Unexpected parameter encountered during deserialization: Name

Unexpected parameter encountered during deserialization: Name @RestResource(urlMapping='/Account/*') global with sharing class MyRestResource { @HttpDelete global static void doDelete() { ...
Rahul's user avatar
  • 1
-2 votes
1 answer
159 views

To have different data type for same variable in Rest API Request body

I am trying to wrap a request body from callin request which has a variable but values can be different data types. Example request body 1 : { RecordId:"cncjdn" } Example request body 2 : { ...
sf developer's user avatar
0 votes
0 answers
210 views

Test.startTest and Test.stopTest affecting RestContext

I have a very weird issue related to an Apex RestResource that I can't seem to wrap my head around. I have an Apex class defined as a RestResource and am trying to test the functionality. In one ...
Antonio Manente's user avatar
-1 votes
1 answer
976 views

How to download a PDF file which is present in Salesforce using Rest Callout

I have to create a RestResource apex class which should let the user to download a pdf from salesforce. I have written the following code, but I am not sure how to proceed further to let file ...
Dilipan Manoharan's user avatar
-1 votes
1 answer
65 views

RestResource HttpGet close new tab

I'm currently trying to work with an integration with an external API (Lansweeper). When trying to authenticate the API, I'm running into an issue where they authenticate through an external url (...
Kevin Yao's user avatar
  • 167
3 votes
1 answer
613 views

User without create permission can create a custom object from Managed package using Custom Rest API

I have a Managed Package where I have Custom Object called Transaction and Apex Rest Resource for creating this object. The Resource Code: @RestResource(urlMapping='/v1/transaction/*') global with ...
Vitalii Dehnerys's user avatar
1 vote
1 answer
285 views

Most Appropriate HTTP Method for Query with Optional Upsert?

I have inherited a REST endpoint that has one key action it performs, named find. This action will generally just query for any matching resources, rank them, and return the most favorable result. ...
Adrian Larson's user avatar
  • 151k
0 votes
1 answer
217 views

Why Tooling API doesn't support composite/sobjects resource? [duplicate]

The documentation for Tooling API suggests that Tooling API supports composite/sobjects resource Update Multiple Records with Fewer Round-Trips Use a PATCH request with sObject Collections to update ...
Patlatus's user avatar
  • 17.8k
1 vote
1 answer
682 views

Getting the error "Invalid constructor name: myFlow.start" when calling the flow interview start() method

I'm trying to invoke an autolaunched flow from an apex class like below, @RestResource(urlMapping='/apex/contact_us') global class ContactUsAPI { Map<String, Object> request = (Map<String,...
Bahman.A's user avatar
  • 928
2 votes
2 answers
237 views

RestResource class with 3 different payloads

I have a scenario where the external party might send three different types of payloads: TypeA, TypeB, TypeC. for TypeA I will match and update 20 Account fields, for TypeB = 10 fiels, for TypeC = ...
kkJhn's user avatar
  • 23
1 vote
0 answers
130 views

End point receipting of touchnet credit card transaction requiring IPs for guest user site for firewall rule

I'm in a real pickle! I have a missing critical, overdue deadline to use a TouchNet Upay site to receive deposits via credit card. Desperate help is needed. My code currently posts out to touchnet ...
Thad's user avatar
  • 51
0 votes
1 answer
144 views

How to define a RestResource method that accepts both HttpGet and httpPost

I've setup a RestResource that receives a webhook from Mailchimp. When setting up the webhook in Mailchimp it verifies the webhook URL exists by calling it with a GET Method but then sends all future ...
Dan's user avatar
  • 215
-1 votes
1 answer
312 views

Can I add suffix in urlMapping for HttpPost in RestResource

I'm having an apex class like this: @RestResource(urlMapping='/api/v1') global without sharing class MyRestService { @HttpGet global static List<sObject> getDataById() {...} @HttpPost global ...
Tuấn Trần quốc's user avatar
0 votes
1 answer
658 views

Preserve order of params in RestRequest

In my RestResource, I need to validate the source of an incoming RestRequest. To do so, I need to create a hash using a concatenated string that includes the full request URL, including the query ...
Diego's user avatar
  • 565
0 votes
0 answers
3k views

Parse blob in apex

We have a @RestResource apex class using which we are receiving the JSON data from application which resides outside of salesforce through REST API. We parse this data to get the jobId from it and ...
Rohan Deoskar's user avatar
1 vote
0 answers
193 views

REST resource Unicode characters not working (form data)

I'm currently developing a Rest Resource that will be able to handle post method into Salesforce. The request that I get is in form-data(!!!). It contains Hebrew characters translated into Unicode (i....
Yaac0's user avatar
  • 165
-2 votes
1 answer
4k views

Test Class for RestResource gives "Methods defined as TestMethod do not support Web service callouts" error [duplicate]

Looking for some help here. I'm trying to write a Test Class for a RestResource I defined but am receiving the above Test Class failure. I was under the impression that you didn't need to define a ...
tontoandbandit's user avatar
0 votes
1 answer
2k views

How do I convert a ContentVersion record to JSON to pass via API?

I need to share files attached to an account externally via API to another Salesforce org (to recreate the files there). In order to do this I'm trying to create a JSON file to contain the file/s ...
Irene's user avatar
  • 1,885
4 votes
1 answer
508 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 ...
KarlLivesey's user avatar
0 votes
1 answer
48 views

Apex Unit Test for Rest Resource calls wrong class

I have 2 RestResource classes: @RestResource(urlMapping='/Catcher/*') global Without Sharing class vecCatcher { @HttpGet global static void httpGet() { ... } } and @RestResource(...
PatMcClellan__c's user avatar
0 votes
0 answers
72 views

"You have uncommited work pending" when there's no obvious DML?

I have a RestResource which is running some callouts, as well as running some DML (after the callouts). I'm recieving this error: You have uncommited work pending. Please commit or rollback before ...
Jessica's user avatar
  • 155
0 votes
1 answer
122 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??
computer's user avatar
3 votes
1 answer
3k 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 ...
Knight of the Vale's user avatar
0 votes
1 answer
594 views

Salesforce RestResource GET API is unable to identify special characters passed in query string

I have created a RestResource API class with GET method. It is supposed to accept the email passed as an input via the query string, and perfom logic based on that email received. It all worked fine ...
Shobhit Saxena's user avatar
1 vote
1 answer
383 views

Is there a way to check @RestResource usage frequency?

Can you please tell me, if there is a way to check @RestResource usage frequency? Short summary: I have a legacy @RestResource which is supposedly not used by anyone. I want to check that. I have ...
Mariia Illarionova's user avatar
0 votes
1 answer
589 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 ...
molinet's user avatar
  • 935
4 votes
1 answer
550 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 ...
Andrew Edmonds's user avatar
2 votes
1 answer
210 views

Apex @RestResource returning result inner class exposes private attributes

Any simple @RestResource may return results in the form of an instance of an inner class. I expect any private attribute of the inner class to stay exposed only to the inner class, thus not be ...
altius_rup's user avatar
0 votes
0 answers
24 views

RestResource Get URL [duplicate]

I have a Rest Web Service class that exposing Get Function. I am trying to get the entire URL of the request to save it in logs. According to the Salesforce Documentation I could get it, without ...
Raphael D's user avatar
  • 636
1 vote
1 answer
408 views

Allow guest profile to update opportunity line Item

I am trying to setup a web hook to use along side PandaDoc to update opportunity line items once approved but the query on web hook when ran on a guest profile does not return a line item. I can run ...
zachary edgell's user avatar
0 votes
1 answer
988 views

How can I call a RestResource through a Community site?

I have a RestResource hosted at /services/apexrest/MyApi. I know that VisualForce pages have an alternative URL through the Community site e.g. /sfsites/c/apex/MyVisualForcePage. Does the same apply ...
Andreas Warberg's user avatar
0 votes
1 answer
950 views

Time delay @future method - need delay for recurring batch process to complete

I have the following requirement and am looking for advice for the best way to process it. We have multiple orgs linked to each other via S2S, with batch jobs running every 10min to pass updates ...
Irene's user avatar
  • 1,885
0 votes
1 answer
1k views

We added the header Access-Control-Allow-Credentials to true

We load JS code by creating a script tag with dynamic src endpoint and append the script element into the page our src will call resource apex class (@RestResource) I know that Community domain is ...
Mohammed Al-said's user avatar
0 votes
1 answer
419 views

How to access custom REST controller in managed package via Site [duplicate]

I had a custom Apex REST controller which was made available by a Site https://xxx.umx.force.com/site-name/services/apexrest/urlMapping But now I've added the Apex class into a managed package, I ...
Robs's user avatar
  • 9,426
0 votes
1 answer
4k views

Create a test class for RestResource class with a response code

I have a @RestResource class which receives data from a third party, finds the matching record and updates it, then returns a success/fail to the third party. I've just added the RestContext.response ...
Irene's user avatar
  • 1,885
1 vote
1 answer
323 views

Why isUpdateable() is not working for non required fields in RestResource class?

I want to update two fields in a custom object from a RestResource class. This is the code I used: @RestResource(urlMapping='/AllHistory/*') global class SampleClass{ @HttpPut global static ...
Jayesh Babu's user avatar
1 vote
1 answer
3k views

Callout to other Salesforce org using Named Credential - which Authentication option should I use?

I have 2 Salesforce orgs (with identical code) - a hub and a client. I need to pass data from the hub to the client. Using S2S is fine for normal data, but when it comes to files (eg pdf) we can't use ...
Irene's user avatar
  • 1,885
0 votes
0 answers
73 views

Is there Salesforce documentation on RestResource Object?

I'm following a design pattern set by one of our devs. RestResource.RequestBody requestBody = RestResource.getRequestBody(); I'm trying to find documentation on this object, but I can't seem to ...
thinker's user avatar
  • 1,482
1 vote
1 answer
137 views

Responsive JSON data

Hi my requirment is : In RestExplorer, Get Method, When i pass below URL # /services/apexrest/partyInquiry?recordId=a1K2F000000Wsom I can get Results below Structure : { "caseInfo": { &...
VidRa's user avatar
  • 11
3 votes
1 answer
1k views

Improve performance of a rest resource

I have a rest resource which fetches more than 10000 records. iterates the list using foreach and adds each record to a custom wrapper class list and finally returns the custom wrapper list as ...
Sisir's user avatar
  • 111
1 vote
1 answer
112 views

Cannot test my own REST API from a beta managed package

I developed a REST API for my managed package which works correctly when tested for development in my scratch org but also as a released managed package. Recently I made minor changes to it - like ...
shillem's user avatar
  • 432
7 votes
1 answer
1k views

Good way to offer both LWCs and a REST API in the same code?

We are building a product that will make use of multiple Lightning Web Components (LWCs), and some of those will make use of @AuraEnabled Apex methods. We also plan to provide an API that non-LWC UI ...
Keith C's user avatar
  • 137k
0 votes
2 answers
1k views

Apply pagination in Rest Resource

I have rest resource exposed to a external system. It is a simple rest api where i get a single parameter from the URL and query a custom object based on that param and return the results in a custom ...
Sisir's user avatar
  • 111
0 votes
1 answer
861 views

RestResource JSON response is adding \"

I have some code where I am building a JSON response. My JSON looks like this String jsonString = ''; jsonString += '{"Order":{'; // order fields jsonString += '"...
Travis's user avatar
  • 352
2 votes
1 answer
92 views

Get nested Json restresource

I have the following json Response I get through a webhook with jira and a @restresource apex class. { "timestamp": 1572538898517, "webhookEvent": "jira:issue_updated", "issue_event_type_name":...
balder's user avatar
  • 23
0 votes
0 answers
500 views

How to access the REST API with the user with Permission 'Is Single Sign-On Enabled' is enabled

I have created one RestResourc to give the ability to the external system to attach the Report to Asset in Salesforce. Now the problem I am facing is the user which I am using for Authentication ...
Nirav Shah's user avatar
0 votes
1 answer
143 views

APEX test script to web server with a static time stamp doget cakk and HttpGet

New to writing test scripts. Looking for help in error in Unexpected token 'Lead' for my test code. I have a static field that pulls off time stamp to only pull data after a certain time. I am ...
Khylin Edwards's user avatar
1 vote
1 answer
348 views

Usage of Connected App in terms of exposing a RestResource API for consumption?

I know I have done it before, but I am lost this time around. Previously, I have created Connected Apps for implementation of Oauth 2.0 authentication process with Salesforce. But, this environment is ...
Shobhit Saxena's user avatar
1 vote
1 answer
592 views

How can I disable my existing Apex REST Webservice in production?

I have an existing Apex REST Webservice configured in production for consumption by a partner for Lead creation. However, we are not working with that partner anymore and hence want to disable this ...
srmaind's user avatar
  • 95