Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [callout]

"HTTP Callouts" connect to a remote web server from Apex code.

-1
votes
0answers
17 views

Chunck Account list into List<List<Account>>() based on a condition

I am having trouble with a small piece of code. I am calling an API, with List of accounts address. API is working fine, but it gives error when URL endpoint length exceeds 3500. I have a look on ...
0
votes
1answer
21 views

How to execute class or method after update external id from post callout

I have a custom object in Salesforce with a set of fields. Some of the fields I sent over by an invocable method which calls a future method to send the first set of fields to entity in an external ...
0
votes
0answers
6 views

Authenticated Callout to Webservice using SSO

We are facing the following problem. We need to make webservice callout through Mulesoft in a way the user is making the call is not a service user, but the logged one: Both Salesforce and ...
1
vote
3answers
31 views

Increase the callout time limit from 120 seconds to more

I am calling a REST API from my Salesforce instance which generally takes 100-150 seconds to process and return the result. The cumulative apex callout time limit is 120 seconds. Is there any way ...
-1
votes
2answers
50 views

Iterable Batch Apex

I want to write a batch class and need to make a webservice callout from it. Once the response is returned in Json format. I want to process the same into objects of salesforce. So I know how to make ...
0
votes
0answers
25 views

Can APEX Capture Cookies in Callout HttpResponse?

I'm trying to post data from my org to a third party using a REST API they've provided for us. The process for this is: POST client_credentials (client_id and client_secret) to obtain access_token ...
-3
votes
1answer
25 views

I am getting error System.HttpResponse[Status=Server Error, StatusCode=500] for the following code [duplicate]

I am runing my code from anonymous window HttpRequest req=new HttpRequest(); Http http=new Http(); //Header req.setHeader('Content-Type','text/xml'); req.setHeader('SOAPAction',''); //Body String ...
2
votes
1answer
30 views

Mock REST and SOAP callouts in the same method

I'm trying to figure out how to test a controller method that does both REST and SOAP callouts in the same transaction. Here is the pseudo code: HelperClass public static void restCallout(){ // ...
0
votes
1answer
38 views

Read Time Out Exception

I am calling REST API method to update some data to another system from apex but getting "common.apex.runtime.impl.ExecutionException: Read timed out" exception. Here is my request code HttpRequest ...
0
votes
1answer
28 views

XML-RPC support in Apex

We have an existing external system whose API documentation mention that the client system should support XML-RPC specification. To consume the services on this external system, can we directly do a ...
9
votes
1answer
565 views

How do I unit test code that includes a callout?

This is a canonical question and answer developed by the community to help address common questions. If you've been directed here, or your question has been closed as a duplicate, please look through ...
0
votes
1answer
22 views

How to callout second time if first request gets timed out

I have been asked this question and I am looking for possible approaches for such scenario. If I make an callout to an external service and if don't receive any response and gets timed out and then ...
0
votes
1answer
9 views

Composite Rest Salesforce

Can we use composite(tree or batch) rest to send multiple POST request to third party(non salesforce endpoint) in a single send call ?
0
votes
0answers
36 views

“Connection reset” exception when sending a callout (HTTP.send())

We have been receiving this intermittent exception when trying to make a callout for a few months now ("Connection reset" is the exception message): Connection reset Class.Sip_HttpUtil.callout: ...
0
votes
1answer
25 views

call out method is not called in a continuous class, call out from VF page

I was trying to do a callout from a VF page constructor. I'm using Continuation class. As I've to show the response in the Page. Yhe problem is the callout method is not called. Below is the code, I ...
2
votes
0answers
41 views

HttpResponse Error 502 on callout to internal URL

Recently, I deployed a change set to my organization production environment. On production, it works fine, but on community my callout doesn't look to work as expected. Basically, on my code, I make a ...
0
votes
1answer
58 views

Callout from scheduled Apex not supported: Retrieving token

I have a scheduled batch class that updates my order payments however I am receiving an error that the callout is not supported. I have read other posts that for batch classes if Database....
0
votes
1answer
36 views

test class with Batch and Callout [duplicate]

I have a problem with FeedItems in my Test class, it's very weird behaviour Does someone explain to me why this happens? Callout Class public with sharing class Callout { public static void ...
0
votes
1answer
35 views

APEX Would like to validate my approach [closed]

I have written the following REST callout to update Club & Players custom object. Based on the API ID club information is fetched and updated, same for players as well. For players I need to check ...
6
votes
2answers
192 views

Is this test for callout wrong? How to make a bulk?

I wrote mock and test for callout, but I don't think it's right. I think I check wrong things with asserts and maybe call the same methods a few times, while have another ways to get 100%. Have I? I ...
0
votes
1answer
27 views

Malformed JSON: Expected '[': wrong test, callout or mock?

I have System.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set and I don't know how to fix it. Callout: public class Callout { public List<Tool__c> toolsList; public ...
1
vote
1answer
66 views

Salesforce limit of synchronous rest service

I have to implement in salesforce many inbound synchronous rest services. What are the salesforce limits that I have to consider? I found only the following: API Requests. A long-running API request ...
0
votes
1answer
45 views

APEX making HTTP Request, and It fails

I'm trying to make an http request, with the UserInfo.getSessionID(), in the authorization value, to https://{{INSTANCE}}.salesforce.com/services/data/v43/ui-api/record-ui/{{sObjectID}} and It ...
0
votes
1answer
26 views

Prevent Record Update Synchronously via External HTTP Call

I'm integrating Salesforce with an external system, and updates to records in Salesforce need to be kept in sync with the system. If the request to the external system fails, the update in SF should ...
0
votes
1answer
40 views

Limits of Batch, REST API: how to get 2000+ records, not just 250?

This code works, but I can get only 250 records even if on other side 2000+ records. I think my batch is incorrect. How can I make a few callouts per 1 time to get 2000+ records from service side? ...
-1
votes
0answers
17 views

How to make HttpGet sending faster and lighter for junction objects?

I have Obj Kid__c and Obj Toy__c with junctions between them. Many-to-many. In junction obj are just Id of Kid__c and Id of Toy__c. I have HttpGet service and Callout which I get Kid__c records from ...
0
votes
2answers
28 views

What's wrong with my Batch Apex + Http callout get method?

I think my code is wrong. Last version of my HttpGet/Callout code (it works): How to use HttpGet service to get a list of objects and create them? Now I try to make it batch. My Execute Anonymous ...
4
votes
3answers
582 views

Confused by CalloutException

I have a trigger on Account and Opportunity - both do a callout to the Google Geocoding API and then update itself using a future method. Now I also want to send an email before the update if certain ...
1
vote
1answer
21 views

HttpGet and Callout: is not a valid Salesforce ID for the type

I get Item's list from 1 organisation and want to insert them like Another Items in 2 organisation. But it try to insert it with Id. How can I fix that? Error: System.DmlException: Insert failed. ...
1
vote
1answer
58 views

How to use HttpGet service to get a list of objects and create them?

I have a callout method which helps to get an list of objects from another salesforce-organisation. But how can I convert this list into objects on callout's organisation side? And how can I do this ...
1
vote
1answer
30 views

Unauthorized endpoint error due to port 444?

I am getting error during callout although I have added the url in remote sites. Can this be due to port 444 which other system has provided? What I can do to fix this as this is external system url ...
3
votes
0answers
79 views

Trying to call API through Apex with custom security certificate but getting CalloutException

I'm trying to use Apex to call some API endpoints to do some validation for my company. There are some specific properties of these APIs that make it a bit tricky: The APIs are hosted on self-...
2
votes
1answer
88 views

Alternatives for handling a Long Running Transaction

I have logic inside an Apex Class that will be invoked from a Lightning Component. There are three sequential callouts that will be sent to an External System whenever its method is Called. As per ...
0
votes
1answer
30 views

Http send is not working with encoded url parameters

I created one class to make http callout to ftp server.I am using Http mock for test class.Sometimes ftp folders are created with space and it is required to encode the file and folder name in ftp url....
0
votes
2answers
37 views

How can I send an error from HttpPost to Callout if ExternalID is the same?

I still can't send to my Callout right status code. I have an Item object in Org2 that I can post from Org1 (in Org1 is Tool object that passes its fields to THIS (Item) object). Item has ExternalID ...
0
votes
1answer
55 views

Parsing XML Response body in Apex

I want to parse the XML body and want to capture the url from the xml body in the list of string which i have created but i am getting Null values in the list Respnse body:- <retours> <...
0
votes
1answer
31 views

How to send error from HttpPost to Callout if ExternalID is the same?

I have an Item object in Org2 that I can post from Org1 (in Org1 is Tool object that passes its fields to THIS (Item) object). Item has ExternalID field that takes the ID from Tool. How can I send an ...
3
votes
1answer
185 views

How to read JSON that contains field that can have different types

I am writing a callout in Apex with returns a JSON file with a field that does not have a consistent type. The JSON returned is quite complicated, so I have been trying to read the JSON with a Apex ...
1
vote
1answer
35 views

How to convert Json string with adminbooster and call a value

I am newbie trying to find a wordflow which makes it easy to convert JSON strings to apex I used adminbooster but get for example public cls_0 0; public class cls_0 { public cls_0 0; throws an ...
0
votes
2answers
32 views

How to deserialize json list, error: Invalid conversion from runtime type List<ANY> to List<or_leadsJSON>

I an trying to deserialize a Json string to use in my callout but get the error Invalid conversion from runtime type List<ANY> to List<or_guestsJSON> Callout HttpResponse response = ...
8
votes
2answers
129 views

Tooling API in Apex - polymorphism, generic query() callout?

I am working on Salesforce project heavily depending on use of Tooling API (we are executing tests on remote SF organizations and gathering results). What bothers me is I cannot use polymporphism ...
1
vote
1answer
60 views

Methods defined as TestMethod do not support Web service callouts - Unit Test [duplicate]

We have a custom object called 'support' - we have process builder configured for this object. in one of the process builder action it will invoke Apex (Invocable Method). This will trigger a callout ...
4
votes
1answer
47 views

How to avoid duplication when using Apex Dropbox API Framework or any other Frameworks/SDKs?

BACKGROUND I need to implement an integration with Dropbox using its REST APIs. I don't want to reinvent the wheel so I decided to use Apex Dropbox API Framework. Although it's a bit outdated (it ...
0
votes
1answer
67 views

How to use if(!Test.isRunningTest()){} for a specific test

I have a class with a callout and a unittest mock for the callout. The callout has a scheduler. If I create a unittest for the scheduler the scheduler tries to do a callout If i use if(!Test....
0
votes
1answer
21 views

How to test 'throw new MyException()' in HttpResponse Callout?

I always get an Fail when try to test the negative scenario. How can I fix it? Sorry, I'm just learning. Callout: public class MyException extends Exception {} public class Token{ public String ...
0
votes
1answer
25 views

How to pass query variable from soql into loop

I am trying to bulkify a callout where I want to pass the recordtype in my loop but I get: Error: Variable does not exist: RecordType If I try public RecordType personAccountRecordType I get ...
1
vote
1answer
46 views

What are the design patterns how to do a batch callout

I know some basics on callouts but would like some advice on doing multiple callouts. Requirements: I have an external system where guests are registered this could be large amounts. I have to get ...
0
votes
1answer
26 views

How can I test my Web Token and posted record from Post Callout?

I try to use HttpCalloutMock to test my post callout. But I become System.NullPointerException: Attempt to de-reference a null object. I need to test and web token, and posted object. I'm just ...
-1
votes
1answer
38 views

How to fix Attempt to de-reference a null object in test for Post Callout?

I become an error System.NullPointerException: Attempt to de-reference a null object in my test: public class Token{ public String accessToken{get;set;} } public static String accessTokenBody(){ ...
1
vote
1answer
25 views

How can I test Post Callout with web token's access? HttpCalloutMock

My POST Method (data for web token - is my custom object's fields): public class Token{ public String accessToken{get;set;} } public static String accessTokenBody(){ //our web token (data is in ...