Search Results
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 |
Apex REST enhances the Force.com REST API to allow developers to create custom REST-enabled web services using Apex.
6
votes
Accepted
Is every APEX REST class a RESTful service?
Once you annotate your class with @RestResource salesforce takes care of setting status and header.
Even if you set return type as void your client requesting resource will still see the status code …
4
votes
Accepted
Is it possible to take the whole post String as the parameter in rest api method?
You can capture the whole request body as the string from Restrequest
@HttpPost
global static void doPost(){
RestRequest req = RestContext.request;
string jsonbody = req.requestBody.toStri …
1
vote
Accepted
JSON Parsing error when serializing a PUT request
You do not need to use String as the parameter and manually deserialize in apex. The platform can automatically deserialize it for you if your parameter names and the JSON have the same name.
Modify y …
6
votes
Posting data to SFDC via rest API
You can use standard REST API as showed by above answer .Also i would like to point out mistake you are doing in the custom REST API
The JSON parameters that you send should match the parmeters of th …
6
votes
How to correctly return data and errors from REST annotated methods?
You can write a Wrapper object instead of the actual object .
Create a wrapper class like below
public class ResponseWrapper{
public list<Account> lstaccounts;
public boolean isError ;
p …
0
votes
How to establish Unique reference between parent child in apex rest insert
There are a couple of considerations here,
Upsert is not possible without you needing an externalId.
Generating externalID like Auto Number yourself is not something I would recommend. This is becau …
4
votes
Accepted
How to return contact and account in a single method
You will return a Account with contacts in same list.
Your SOQL should have inner query for contacts linked with account .
Code :
Account acc = [select id ,name ,(select id ,Name from contacts) fro …
1
vote
Accepted
how to customize the response(add CaseNumber fields) of the http POST method?
You will have to query back the Case Number and return the object like below
@HttpPost
global static string dopost() {
RestRequest req = RestContext.request;
RestResponse …
1
vote
Accepted
How to document custom REST API in Salesforce
This is unrelated to Salesforce but salesforce does not provide any native tooling to document your Custom REST API .Instead I would explore Swagger to assist me with the tooling .
Swagger Editor is …
2
votes
How to use the apexrest with C#
A .NET tool kit was announced by salesforce.
"The Force.com Toolkit for .NET provides an easy way for .NET developers to interact with the Force.com REST API using a native libraries."
https://githu …
4
votes
Accepted
Why am I getting "Service not found error" when trying to access a @RestResource when it is ...
Your url to try hitting would be as below
services/apexrest/namespace/abc/contractors
Here note namespace is the actual namespace of your package …
0
votes
Exposing class as webservice
You will first need to generate WSDL using
Setup > App Setup > Develop > Apex Classes
There will be a WSDL link use that and generate WSDL.
You will need to share your enterprise WSDL as well …
2
votes
Accepted
REST SERVICE - Unexpected parameter encountered during deserialization
This certainly looks like a problem in your JSON serialization implementation in your Java program .
Assuming you are using JSON.simple imports like below
import org.json.simple.JSONObject;
The pr …
7
votes
Accepted
Future method cannot be called from a future or batch method: Error
As the error states you are calling a future method from another future method .
Your class A calls Class B but I see again you call Class A methods in Class B causing recursion .
Hence would sugges …
12
votes
Accepted
How to see JSON response for REST service?
Your endpoint to test will be
/services/apexrest/BP_Routes
Also looks like the method is accepting a string parameter ,so you will need to select post and then the JSON input is
{
"username" : …