Questions tagged [sfrestrequest]
The sfrestrequest tag has no summary.
18 questions
0 votes
1 answer
333 views
"message": "JSON request body must be an object at [line:1, column:2]","errorCode": "JSON_PARSER_ERROR"
I attempted to send an HTTP request and transmit a JSON to the Salesforce REST API in the following manner, but encountered the following error: Error: [ { "message": "JSON request body ...
1 vote
2 answers
2k views
Apex Callout Issue - System.HttpResponse [Status=Moved Permanently, StatusCode=301]
I am trying to make a callout to an open public api. When I tested it on Postman, it is giving me the expected response. But when I tried it on the Apex class, the response is giving me the following ...
10 votes
2 answers
60k views
{"error":"invalid_grant","error_description":"authentication failure"}
I know this must have been posted here and I've tried the solutions I've searched across the web but I am still getting the error {"error":"invalid_grant","error_description&...
0 votes
0 answers
90 views
Apex callout yields "Ending position out of bounds: -1" error
This is my vf page <apex:page controller="AccountRest"> <apex:sectionHeader title="Accounts" subtitle="List View"/> <apex:pageBlock> <apex:pageBlockTable value=...
1 vote
1 answer
5k views
Apex Rest - Api error handling HTTP status codes
I am trying to handle multiple error codes in my REST service. Can anyone guide me if I am doing this correctly. try { if(Limits.getDmlRows() < Limits.getLimitDmlRows()){ ...
2 votes
1 answer
6k views
to remove null value from the JSON response
I need help with sorting/cleaning up a json object. I have a global class for calling out responses with 4-5 objects. Consider this example (for sample with 2 objects), My requirement is that I have ...
0 votes
0 answers
109 views
entityFields="*" returns record ={}
Using signed request to run canvas app through a vf page. If entityFields=" * " is specified for the contact vf page, then the returned record is coming as empty. It works perfectly fine for all the ...
0 votes
1 answer
2k views
HTTP 400 Bad Request trying to create a bulk API job using RestTemplate
Am trying to use spring RestTemplate to create a bulk API job. Below is the code HttpHeaders headers= new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.add("sforce-enable-...
6 votes
1 answer
4k views
RestContext.request.RequestBody encoding/decoding %5D
I have a REST service which is receiving the encoded body of a post request, and I'm not able to decode the body into a valid json string for parsing. I also don't have much control over the ...
1 vote
1 answer
933 views
Is salesforce apex rest parameter name case sensitive?
Let's consider the following rest request url for example https://login.salesforce.com/services/apexrest/paramcheck?User_ID=013456 Is parameter 'User_ID' case-sensitive? Can I use 'user_id' instead ...
1 vote
0 answers
124 views
Rest API - Duplicate products and partners are added to opportunities
I'm trying to add 2 products and 2 partners to an existing opportunity through REST API. Even though both products and partners are different, they have the same name and product code in SFDC. ...
5 votes
2 answers
4k views
Tooling API execute anonymous results
I am trying to run an execute anonymous statement using tooling API. I am running a very simple System.debug('test'); Now the issue is as this is a GET request, the response that I get is like this -...
7 votes
2 answers
7k views
What IP is my Salesforce calling from in my REST call?
I wrote a REST service to call another system from Salesforce. They have firewalls up and such and I instructed them to Whitelist the Salesforce force suggested IPs at Salesforce IP Address to ...
1 vote
2 answers
144 views
Checking syntax of SFRestRequest
I am unable to get a response back ("didloadresponse" doesn't fire) from SFRestRequest and I am not sure why. Is the syntax of _queryParams correct?
1 vote
1 answer
151 views
Identifying the callback to a SFRestRequest delegate
Is it possible and safe to set the SFNetworkOperation tag in the method initiating the request, and then read it back in the delegate method, to distinguish which request was made? Or is there a ...