Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 3996

Apex REST enhances the Force.com REST API to allow developers to create custom REST-enabled web services using Apex.

0 votes

Rest API Parameters are received as null

As a starting point, I recreated you class and request. Using the dev console the output was properly displayed. Check to ensure your URL you are creating does not include and special characters befor …
Eric's user avatar
  • 54.4k
2 votes

how to get the value i passed to my apex endpoint from post request?

CustomerEndPoint { @HttpPost global static void loginCustomer() { System.debug(JSON.deserializeUntyped(req.requestBody.toString())); } } Endpoint used https://xyz.my.salesforce.com/services/apexrest
Eric's user avatar
  • 54.4k
0 votes

RestResponse does not return expected statuc code in Apex Rest unit test

You are debugging properties that have never been assigned or set And you test should be res = UserManagementRestController.createMyId(); And your debugs should be: System.debug(req); System.debu …
Eric's user avatar
  • 54.4k
1 vote

rest api to create account from one sf instance to another sf instance

Here is an example controller that one of my test VF pages uses to test the oAuth flow. Other classes can use it as well to authorize, the connected app uses the sample vf page as the callback: p …
Eric's user avatar
  • 54.4k
3 votes
Accepted

Cannot use String in Apex REST

The code should be: message.escapeECMAScript(); escapeECMAScript is not a static method of the string class, it must be called from an existing string object
Eric's user avatar
  • 54.4k
5 votes
Accepted

Cant catch exception and log to custom object if I throw exception

Unfortunately if your ending point in the code is throwing an error ALL of the transaction gets rolled back including your log creation. This creates quite the issue. Future methods also get canceled …
Eric's user avatar
  • 54.4k
2 votes
Accepted

Access rest service oauth

Check the login history for the user and make sure you are connecting to the right url TEST vs LOGIN. I am willing to bet that the Security Token is being required and you are not appending that to y …
Eric's user avatar
  • 54.4k
1 vote

Cannot call apex rest service from jquery on Visualforce page

A quick google search return pretty helpful results: Code: function CallRestAPI() { var weblink = "http://URL"; $.ajax( { url : weblink, type : 'GET', dataType: 'json', beforeSend: function (reques …
Eric's user avatar
  • 54.4k
5 votes

How to see JSON response for REST service?

IN exec anonymous simply type: system.debug(BP_Routes.BP_Routes('APPROPRIATEUSERNAMEHERE')); and it will debug what is returned. If you like you can serialize it since it is not serialized in your …
Eric's user avatar
  • 54.4k
3 votes
Accepted

For an SObject parameter of an Apex REST API, how can you pass in nested related objects?

Account a = [Select Id, Name, (Select FirstName, LastName From Contacts) From Account Where Id = :tmp.AccountId]; HttpRequest req = New HttpRequest(); req.setEndpoint('https://{instanceurl}/services/apexrest
Eric's user avatar
  • 54.4k