Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [restresource]

The tag has no usage guidance.

0
votes
1answer
30 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
20 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
votes
1answer
156 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
94 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. ...
0
votes
2answers
91 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):...
1
vote
1answer
1k 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
30 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
0answers
87 views

PATCH/PUT Rest - List of sObjects

I would like to create a API Rest where my endpoint receive a list of Accounts in JSON, the list contains few fields of the account with the new values to update. This is my actual code, but it works ...
0
votes
1answer
57 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
42 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
70 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 ...
0
votes
1answer
441 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
247 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
68 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
102 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 there ...
6
votes
2answers
2k 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
57 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
16 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
254 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 ...
0
votes
1answer
82 views

AppExchange CRUD FLS for task object

When I apply CRUD FLS to submit my code for code scanner my class business logic is not working even though I have given all access to task and activity object. Class is rest resource class and is ...
3
votes
1answer
65 views

How to consume a salesforce REST service?

I want to integrate two salesforce orgs using username-password flow. First I got access token, after that I'm trying to call another service which is located in the org. I'm getting following error. ...
5
votes
1answer
3k views

Authentication using JWT

I am new to use JWT for authenticating external requests. I went through this help article. I am trying to implement above for the following usecase: External application (client) wants to access ...
1
vote
1answer
1k views

RestResource Annotation - What is the urlMapping To?

I have never worked with Rest Resource classes before and am trying to debug one from a previous developer. I am looking at: @RestResource(urlMapping='/CompanyData/*') and am unsure what CompanyData ...
0
votes
1answer
28 views

Why POST is routed to GET?

I have rest controller with GET, DELETE and POST. GET and DELETE work ok. @RestResource(urlMapping='/test123') global class TestRest { @HttpGet global static String getOperation(){ ...
0
votes
1answer
71 views

unable to access returned values of global class method

I am trying to access the returned values of a global class method and store them in a string. The string is declared as global static string. The value gets stored in the string when in the method. ...
0
votes
2answers
58 views

Need help Rest Webservices

I am new to Rest Webservices and need some help. I have a requirement where the external system creates an account and is calling the Rest webservice to send the created account details as a response ...
1
vote
1answer
237 views

refrain from unescaping special characters when receiving restcontext json?

I've set up an @RestResource class for receiving an external JSON webhook through an @httppost class, which is working great, but when retrieving the content of the request through RestContext.request....
1
vote
1answer
67 views

RestExplorer in Workbench Get Error?

I would like to test a Get endpoint in Workbench via the rest Explorer. However I'm getting a services not found error when executing. Any suggestions on what I need to change? Below is the endpoint ...
0
votes
0answers
196 views

APEX REST Web Service: Can not deserialize: unexpected array

It is working fine in workbench but when request is coming from middleware soa it is receiving error [{"errorCode":"JSON_PARSER_ERROR","message":"Can not deserialize: unexpected array at [line:2, ...
0
votes
1answer
92 views

Rest Test class failing in production

I have the following Rest class and test class. The test class is working good in sandbox and failed in production. I have gone through numerous post and also followed to test with Mockclass as well. ...
1
vote
1answer
2k views

A testclass for @RestResource @HttpPost

I have a @HttpPost method in @RestResource class: @RestResource(urlMapping='/Something/*') global with sharing class HttpClass { @HttpPost global static String updateCustomObject() { //Fetching ...
2
votes
1answer
453 views

Use of Wildcard in Apex rest service

I have been using rest service and building them for long time but something which I am not clear is on the wildcard part. Whenever I had to expose an Apex rest service I expose apex class with ...
8
votes
3answers
1k views

How to see JSON response for REST service?

How I can see what the JSON response looks like for a REST service that looks like the one below? I guess I'm looking for the actual steps of what I need to do to see the JSON response. @...
1
vote
1answer
513 views

RestResource urlMapping routing is conflicting with a similar URL

So we have a number of mapped urls, and up until recently they were working fine. We recently noticed that our requests are inconsistently being routed to the wrong APIs. Example: @restResource(...
1
vote
0answers
332 views

calling RestResource with a list of SObjects

I have a simple rest resource that takes in a list of Contract objects and just prints out some information about them. @RestResource(urlMapping='/contracttest/*') global with sharing class ...
9
votes
2answers
800 views

ID query string parameter call to RestResource results in error

I'm looking to set up a RestResource endpoint that accepts some URL parameters and creates a lead record. Here's the basic gist of my code: @RestResource(urlMapping='/createLead/*') global with ...
2
votes
2answers
788 views

Rest api HttpGet issue

I have created a class for api request. I am also sending a parameter in url while requesting for HttpGet. How can I get the value from the url in a HttpGet method. When I added the RestRequest req, ...
2
votes
2answers
397 views

Creating an Apex Rest Resource for a Request with reserved keywords

I am working on an Apex Rest Resource to provide an integration from our scm provider's web hooks. The request sent by the scm provider is in JSON format so I have created an Apex class to mirror that ...
2
votes
1answer
113 views

RestRequest in RestResource is returning null

I am having a problem reading JSON content using a RestResource. I am always getting a null value. My goal is to create a webhook to receive JSON content. Here is what I did. Created a Visualforce ...
1
vote
2answers
872 views

Calling Rest resource issue from Force.com sites

I have rest resource class which i am calling from force.com site.. Below is my endpoint https://cs22.force.com/services/apexrest/CustomerData/ @RestResource(urlMapping='/CustomerData/*') global ...
5
votes
1answer
3k views

Could not find a match for URL Workbench

I am trying to test my code from workbench by sending an xml file to my @restresource global class. I have a @httpPost method through which I wan to insert the record. When I try to send a request to ...
1
vote
2answers
201 views

How to identify what type of request is coming

I have a class with @restresource. To which a request is coming to insert the record. How can we identify what kind of request is coming in. Is it XML or JSON format. Is there any way to identify ...