6
votes
Accepted
@IsTest - How to get the RestContext.response from @HttpPost if the post method is not returning
You need to call the actual http method for it to invoke the API and then if you check, it should have the response.
@IsTest
static void TestBehavior() {
RestRequest request = new RestRequest();
...
4
votes
Convert response to a string
This JSON is mangled: you have a single outer key, Account, whose value is not more JSON but a string value containing escaped JSON.
It would be best to fix this at the source of this JSON by ...
3
votes
Lightning component not returning a response
Why don't I get an update on my object ?
-> null null null null
Cant get create a record if your apex controlLer does not receive any values.
Why dont I get a response in my lightning component?
...
3
votes
Accepted
Create a test class for RestResource class with a response code
It appears all I needed to do was add this to the test class at the start of the method (before the Account acct... line):
RestRequest req = new RestRequest();
RestResponse res = new RestResponse();
...
1
vote
External Services - Nested object in response appears to be blank in Flow but is populated in Postman
UPDATE
Confirmed, the issue is with the flow mapping. In order to get it working I created a variable resource of apex-defined type, choosing the ExternalService autogenerated class, and used it in ...
1
vote
Accepted
Receiving no response from Salesforce on patch API call
A successful update is a 204 response. That status code means "your operation was successful, and there is no response body." If there were an error, you'd get a 4xx or 5xx status code with ...
1
vote
Accepted
How can I correctly build a query to get the fields of an object I need from the database?
You must use a binding by prefixing the reference to newContact.Id using a colon:
@AuraEnabled
public static Contact createContact(Contact newContact){
upsert newContact;
return [SELECT Name, ...
1
vote
Accepted
Sending status code with response using apex
Welcome to Salesforce StackExchange, As I understood you have facing issue with implementation logic of error handling / Response of the request.
I would prefer to User Database.insert() rather than ...
1
vote
Accepted
Rest reponse for empty field
You're not going to get an empty string unless you write some code to make it so. Salesforce does not store empty strings in the database, only null; when you query a record with a Text field that ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
response × 14apex × 3
rest-api × 3
json × 2
rest × 2
apexrest × 2
marketing-cloud × 1
lightning-aura-components × 1
soql × 1
javascript × 1
unit-test × 1
api × 1
visual-workflow × 1
marketing-cloud-connect × 1
date × 1
cloudpage × 1
pagereference × 1
landing-page × 1
notification × 1
http × 1
time × 1
nested × 1
restresource × 1
httppost × 1
survey × 1