Questions tagged [restresource]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
41 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
16 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
39 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
58 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
53 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
51 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 ...
1
vote
0answers
21 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
53 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
31 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
29 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 ...
0
votes
1answer
360 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
122 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
226 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
3k 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
40 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
76 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
62 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
94 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
1k 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
363 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
114 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
153 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
3k 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
91 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
21 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
359 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
92 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
80 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. ...
9
votes
1answer
6k 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
2k 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
29 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
93 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
64 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
324 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
184 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
1answer
104 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
3k 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
590 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. @...
2
votes
1answer
602 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
361 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
891 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
951 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
420 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
140 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
927 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 ...
6
votes
1answer
4k 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
210 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 ...