Questions tagged [restresource]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
42 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 ...
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 ...
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 ...
0
votes
1answer
38 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
1answer
98 views

CORS issue in LWC

I am testing on Field Service Lightning mobile app LWC pilot feature. Here apex is not supported in Field service mobile with LWC. So, I am trying to make a SF rest resource callout, to get the ...
2
votes
1answer
56 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 ...
0
votes
0answers
23 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 ...
1
vote
1answer
97 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 ...
0
votes
1answer
71 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 ...
0
votes
1answer
33 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 ...
0
votes
1answer
536 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 ...
0
votes
1answer
28 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 ...
0
votes
1answer
265 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 ...
1
vote
1answer
89 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 ...
1
vote
1answer
458 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 ...
0
votes
0answers
42 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 ...
1
vote
1answer
66 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": { &...
0
votes
1answer
122 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 ...
1
vote
1answer
46 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 ...
7
votes
1answer
269 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 ...
0
votes
2answers
270 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 ...
0
votes
1answer
53 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 += '"...
2
votes
1answer
36 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":...
0
votes
0answers
128 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 ...
0
votes
1answer
63 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 ...
1
vote
1answer
75 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 ...
1
vote
1answer
184 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 ...
1
vote
2answers
305 views

WebService Post Rest API is Receiving as GET

I wrote a web service using @RestResource With both Get and Post methods. When I try to send a request via workbench - everything works great, but when I try to send a post request using other ...
0
votes
2answers
361 views

Username Password Auth Flow returning different response than expected

I'm trying to get the access token using Salesforce Username/Password OAuth flow. I have created a connected app, provided full access in the Oauth scopes and pre-authorized System Admin profile users....
0
votes
1answer
510 views

How to return response to a Shopify Webhook?

I have a Salesforce site which is used as a rest resource for a Shopify Webhook for new Order Creation. When a new order is created in Shopify it hits the Url provided by us and expects a "200 OK" in ...
2
votes
1answer
30 views

RestResource being Triggered upon Viewing a Record

Overview - i recently was assigned to take over a project which was started by an outside consultant. I am unfamiliar with RestResources which is what this project was built on. MY ISSUE:I need to get ...
1
vote
1answer
789 views

Is there a better rest endpoint for downloading file contents?

I'm trying to use https://[domain]/sfc/servlet.shepherd/version/download/ to download files (lightning files not attachments) from salesforce and it works sometimes and I can get it to work in postman ...
0
votes
1answer
51 views

the vf page not dispaying the API value this is my code can any one help me out this

apex class: public with sharing class AccountWeatherController { public String response { get; set; } public String city {get;set;} public String temp {get;set;} public String ...
2
votes
0answers
54 views

Is there a way to specify an API version of a call to @RestResource?

I would like to specify an API version when I call a @RestResource via an API. Is that possible? Why For some reason, our Spring '19 sandbox is having a weird issue, and I'd like to fix this before ...
1
vote
1answer
1k views

Rest Resource URL mapping in workbench

i have written a rest web service class and mapped the resource as '/Accounts/*/contacts'. where * stands for Accountid. I am trying to do a POST call from workbench and having issue writing server ...
6
votes
2answers
422 views

Silence the AvoidGlobalModifier warning in @RestResource Apex controller

I have a simple Apex Controller annotated with @RestResource. According to the documentation, this must be declared global, but the static analysis complains due to the AvoidGlobalModifier PMD rule. ...
1
vote
2answers
654 views

RestResource HttpPost - 401 Unauthorized - INVALID_SESSION_ID

I am attempting to call a RestResource HttpPost method, but receive an INVALID_SESSION_ID response. [{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}] Apex Code (version 43):...
5
votes
1answer
8k views

Posting a JSON to REST resource in Salesforce

Before I go ahead and describe my issue, I have looked at a resolution as described below and does not seem to help in my case. is that possible to pass(POST) below JSON to REST endpoint? So, I have ...
2
votes
1answer
126 views

Why am I not able to parse valid XML straight from the Salesforce Documentation, but JSON works fine?

On this particular page: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_methods.htm About halfway down, you'll see a method which I have included in my class @...
0
votes
1answer
376 views

CRUD FLS issue to edit task access for site guest user

I am applying CRUD FLS on task object fields and also I have provided read and edit access to task for site user profile. Even checked with sharing settings as 'Controlled by parent'. But still when ...
6
votes
1answer
99 views

Strip Authorisation header from inbound REST Request

I'm integrating with a 3rd party data provider. The way their platform works is you must provide an endpoint to which they periodically send REST requests to with updated data etc. They happen to ...
1
vote
1answer
156 views

Xero WebHook Force.com Site

I am trying to get Xero to send a WebHook to Salesforce so we can capture updates to Contacts and Invoices. I created an Unauthenticated RESTful web-service by exposing the RestResource annotated ...
1
vote
1answer
5k views

URL_NOT_RESET error REST API

I have created the REST Resource to fetch the data from Salesforce. My Domain is also activated in our Org. When I fetch the data using https://myDomain.my.salesforce.com/.../... it is returning me ...
0
votes
1answer
749 views

Total Record Count in API Call

I have created Restful Resource (Http Get API) to fetch the data from Salesforce. I have more than 9 Lac records in my custom object which I need to send via API. I have implemented the Max Row and ...
0
votes
1answer
382 views

How does Org Namespace in Request URI work from Apex Rest Web Service Test Class?

I am having big problem understanding how namespace works in the RequestURI of Apex Rest Web Services when you deploy them as part of a managed package, and hence, writing a proper Test Class for that,...
2
votes
1answer
380 views

RestResource Annotation - UrlMapping is NOT allowed

As per the Salesforce Article Winter / Spring '18 Apex Compiler Changes it is mentioned that UrlMapping is NOT allowed for @HttpPost UrlMapping and URL strings are NOT allowed for @HttpGet but ...
10
votes
2answers
8k views

RestResource GET with multiple parameters

In Apex RestResource What is the correct format for urlMapping when you want to pass in multiple parameters in a GET request? So I need to pass in accountId and serviceId as filters to GET. @...
1
vote
1answer
274 views

@HttpPost test will not run - Method does not exist or incorrect signature: void doPost(String,

Just started with Apex last week so very new. Building a @RestResource to pick up webhooks sent from an external DB. Code has been tested and working as expected in Sandbox. Can not get the unit ...
1
vote
1answer
27 views

Test Class calling Rest Resource with List containing multiple variable types

I have a RestResource class that is called by our backend to perform a specific action. The problem is that when I attempt to test for this class, I run into a snag. The Class accepts a JSON file from ...
2
votes
1answer
1k views

Test Method for @HttpPost RestResource is not returning expected results

I have been looking all over the boards and found some useful posts regarding testing rest services, but even after spending the last 2 hours trying to implement many of those ideas, I still am stuck ...