13
votes
Accepted
Can we Have two Http Mock Callouts in a single test class method
Yes, you can, using either of two techniques.
Your HttpCalloutMock's respond() method can inspect its inbound HttpRequest, and construct a different response based on which endpoint is being called, ...
8
votes
Are there any external call out limits in Marketing Cloud?
To my knowledge, the following are the limitations:
Callout Limits: Currently there is not much documented, but there is a 'limit' of 2000 SOAP calls per minute. The other consideration is that if ...
7
votes
What is the difference between callout and HTTP request?
No, that's nor quite right. Imagine callout as animal and Http as cat, it's a subclass, not the actual class.
What I mean is you have 2 types of callouts in Apex:
Http http = new Http();
http.send(/*...
6
votes
PATCH request using Apex HttpRequest
1) Please vote for the PATCH verb to be added here:
https://success.salesforce.com/ideaView?id=0873A000000PST0QAO
2) In case the URL parameter override does not work, you can attempt using an HTTP ...
5
votes
Accepted
Not full URL in Referer header in Visualforce since Spring '17
Please refer the Salesforce Spring ’17 Release Notes, this was implemented to enhance security of the platform.
Updated Referer Header
When loading assets outside of Salesforce, or navigating outside ...
5
votes
Accepted
TLS version and HTTP supported in production
TLS 1.1 and 1.2 are supported regardless of when you enable this critical update. TLS 1.0 will not be automatically disabled in your Production Instance until March 4, 2017, at 9:30 AM PST. Until that ...
5
votes
Accepted
"message":"INVALID_HEADER_TYPE","errorCode":"INVALID_AUTH_HEADER" received
There was a talk on using Named Credentials to call back into the same Salesforce org at Dreamforce this year 2018: Named Credentials: Securing and Simplifying API Callouts. Looks like it was the same ...
4
votes
TLS version and HTTP supported in production
TLS is the transport layer which encrypts your connection while commenting between Server - Client. So, eventually there have been cryptographic improvements in TLS. Previously it was TLS 1.0 which ...
4
votes
Accepted
How to perform a DML insert after HTTP Callout (save a log of the response)
Your assumption:
I asume that the last step, as the Doc says cannot be performed, since
I cannot do an insert after a HTTP Callout.
is not correct
You can do a dml after the callout just not ...
4
votes
Accepted
Wrapper class in Http getmethod
Global methods must return global data types. You need to declare your class as global in order to use it as a return value.
As a side note, there's no point to your try-catch block here, because ...
4
votes
Accepted
Help with Rest Resource
You need to annotate your POST handler method with the @httpPost decorator. That way Salesforce knows to run that method when the REST Request method from outside is set to "POST".
It should ...
3
votes
Process Builder Outbound Message
I'll try to answer point-by-point
Is it a good thing to do? One advantage to the HTTP Callout is that you have a greater range of options for the payload... you could send a collection, or related ...
3
votes
Named Credentials - Merge Fields not Resolving
I was running into a similar issue.
If you are doing a GET call make sure you don't append a body or your request will NOT work with even with the correct headers. If you are doing a POST the ...
3
votes
HTTP call using Salesforce
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
This code is not correct. The automatic "toString" method ...
3
votes
Accepted
405 response code when trying to callout to Google
You can't post data directly to google so you need to get data using API.
Http http = new Http();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
req....
3
votes
Accepted
Creating REST Api with little control over request structure
One method you could try would be to set up a public force.com site, and allow the public user access to your global Apex class.
An alternative to that method is to set up an intermediary web server (...
3
votes
Convert Multile Objects to a single json
This code will do what you require:
req.setBody(JSON.serialize(new Map<String, Object>{
'left': leftFileParameters,
'right': rightFileParameters,
'common': commonParameters
}));
...
3
votes
Make http callout in batch after insert actions
Batch chaining (bottom of the page here) is probably the most idiomatic solution, because it'll allow you to process more than 100 records and because your situation does not appear to be amenable to ...
3
votes
Accepted
SSJS HTTP Get method error - Unable to retrieve security descriptor for this frame
The simple query version is a GET, but you need to use POST for the Advanced Query version.
Using HTTP.POST instead will likely get you the expected results.
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();
...
2
votes
How to use HTTPGet variable in URL (ExactTarget)?
You can also use the RedirectTo function to use the URL inside your html code.
<a href="%%=RedirectTo(@linkURL)=%%" target="_blank">
2
votes
How to use HTTPGet variable in URL (ExactTarget)?
Adding to this answer. If you want to track links from the html you are pulling in, you will need to use a wrap function as well, as so:
%%[
set @var1 = "http://someurl.com"
var @getStatus, @...
2
votes
How can I make a PATCH HTTP Callout from Apex?
The release notes for Winter `21 (v50.0) indicate that PATCH support will be coming to Apex.
Update Resources with the PATCH HTTP Method in Apex Callouts
To make partial or full updates to a resource ...
2
votes
pass string value
You don't want to escape the quote characters, because then they become part of the string itself (so you'd be sending '+abc+' instead of the contents of abc).
String requestString =
'<?xml ...
2
votes
Accepted
Trigger to use HTTP callout and update record with the results
Your future method will need some input to act upon, so a set of referral_advocate__c Ids (for bulkification purposes; this set of Ids would be built in the trigger on any record that has unique_ID__c ...
2
votes
Accepted
unauthenticated Visualforce page through sites - https access
To require secure connections, under "Setup", go to the site you would like to be accessible through https, press "Edit", then select the "Require Secure Connections (HTTPS)" checkbox.
However, ...
2
votes
Accepted
HTTP/ JSON Response - Developer Console
You need to deserialize into the proper type. In this case, that's the top level class (WeatherLocation). I stripped out some irrelevant attributes from your payload and it came through clean. Here's ...
2
votes
Http request not returning token through Apex
So if anyone is blindly stumbling around trying to create a HTTP request like me, make sure that you pay attention to cases sensitivity in the authorisation header. In my case I was using "BASIC token"...
2
votes
Secure a Landing Page
You can request an SSL certificate from Salesforce, which will be applied to a.o. your Cloud Pages - when you have applied a Sender Authentication Package, and using your own domain for Cloud Pages. ...
2
votes
Accepted
Metadata Rest API for custom objects
Based on the discussions in the comments, you have two requests here:
To create custom objects using API/UI
To create records within those custom objects
You can achieve these using the different ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
http × 142apex × 65
callout × 36
httprequest × 34
httpresponse × 18
rest-api × 16
visualforce × 15
rest × 10
unit-test × 9
post × 9
marketing-cloud × 8
api × 8
httppost × 8
integration × 7
batch × 6
httpcalloutmock × 6
json × 5
apexrest × 5
exception × 4
trigger × 3
code-coverage × 3
class × 3
webservices × 3
security × 3
ssjs × 3