Hot answers tagged

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, ...
David Reed's user avatar
  • 92.1k
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 ...
Gortonington's user avatar
  • 30.3k
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(/*...
Mariia Illarionova's user avatar
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 ...
MayTheSForceBeWithYou's user avatar
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 ...
Saroj Bera's user avatar
  • 14.6k
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 ...
Adrian Larson's user avatar
  • 149k
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 ...
Daniel Ballinger's user avatar
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 ...
Ashwani's user avatar
  • 22.6k
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 ...
Eric's user avatar
  • 54k
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 ...
sfdcfox's user avatar
  • 481k
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 ...
John Thompson's user avatar
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 ...
John Thompson's user avatar
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 ...
NickZeus's user avatar
  • 177
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 ...
sfdcfox's user avatar
  • 481k
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....
Himanshu's user avatar
  • 10.5k
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 (...
Derek F's user avatar
  • 59.4k
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 })); ...
Keith C's user avatar
  • 135k
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 ...
David Reed's user avatar
  • 92.1k
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.
Gortonington's user avatar
  • 30.3k
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(); ...
Irene's user avatar
  • 1,765
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">
Nathalie Reginster-Starr's user avatar
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, @...
Chester Bullock's user avatar
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 ...
Daniel Ballinger's user avatar
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 ...
sfdcfox's user avatar
  • 481k
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 ...
Leapin Dave's user avatar
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, ...
SFDC Neuf's user avatar
  • 1,497
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 ...
Adrian Larson's user avatar
  • 149k
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"...
Joe Beech's user avatar
  • 125
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. ...
Lukas Lunow's user avatar
  • 20.6k
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 ...
Jayant Das's user avatar
  • 30.3k

Only top scored, non community-wiki answers of a minimum length are eligible