Questions tagged [callout]

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

Filter by
Sorted by
Tagged with
5
votes
0answers
32 views

How can I unit test a http callout that uses a certificate?

The .setClientCertificateName method of the HttpRequest class requires a string that is the name of a certificate in the organization. In a unit test class, is it possible to mock this method? When I ...
0
votes
1answer
17 views

Can Remote Site Settings whitelist IP addresses instead of/in addition to domains?

I'm just wondering: We make a number of callouts from Salesforce to different APIs, and so obviously we need to whitelist their respective domains with Remote Site Settings. However, I'm wondering ...
2
votes
3answers
65 views

What method to use in a batch apex in order to get authentication token from a remote server?

I have a batch class that uses query locator to send data into the client's server. however, it must first authenticate and get access token and send that along with the data with all consecutive post ...
0
votes
1answer
37 views

dynamic json body as http post request

public class RequestWrapper { public static GetUrlRequest GetUrlRequest; public class OrderDetails { public String txnId; public String custOrder; public ...
0
votes
0answers
28 views

Issue converting file object types to String format from an incoming OneDrive REST API call

I'm trying to pull a file object-type from O365 via the Graph API and I'm getting back a return-type that is pretty atypical to the normal JSON return format I'd expect to see. I'm not sure if it's ...
0
votes
2answers
41 views

Testing a trigger calling batch class for making a callout gives System.CalloutException

I am trying to write unit test for a a trigger which calls batch apex which performs callout and updates the response to certain record. Trigger's psuedo code looks like: trigger AccountTrigger on ...
0
votes
1answer
47 views

How to make a trigger callout to delete files from AWS?

Please help me with my problem.. what I should do is when a user deletes a file, a trigger will check if there is existing file ID (File_Id__c) in the Custom_Object__c, if so, delete it in AWSS3 as ...
1
vote
0answers
23 views

Rest API callout using basic authorisation

String filter = 'OrderNumber eq \'1000035\' and SoldtoCustomer eq \'10045005\''; String Username = user; String Password = pass; String expand = 'EvLineDetailsSet'; String format ='...
0
votes
1answer
41 views

Connect Apex Class to a custom Screen

I have created a custom apex class that makes an HTTP POST call using callouts. Right now I have it running on a schedule using an @future method. This is working fine, but I actually want to connect ...
1
vote
0answers
187 views

System.CalloutException: Unable to tunnel through proxy. Proxy returns “HTTP/1.1 503 Service Unavailable”

I'm trying to make an HTTP Request to other System. They provided the endpoint URL which contains a Port number. https://Test.com:50001/RESTAP/BGN/PRDV/CREATE When I'm trying to make the request I ...
2
votes
1answer
37 views

How do I make Apex callout to a OpenID Connect endpoint protected by PKCE code challenge?

I'm trying to write Apex code that'll call an external API. The API is using OpenID Connect for authentication, meaning I'll have to first give consent in order to get an authorization code, then ...
0
votes
1answer
24 views

Simplifying REST API calls

I'm new to Java programming and I'm trying to reduce the number of REST API calls I make in my program to better organize it and I'm not sure how best to approach it if the simplest way is to have a ...
-1
votes
1answer
29 views

Salesforce Integration with Oracle

I need to Integrate Salesforce with Oracle Platform (Create Account in Salesforce when its created in Oracle platform). I researched and understood that It could be done by API Callout methods. Could ...
0
votes
1answer
30 views

Connect Campaign Members to Opportunities Using SOQL

I am trying to create a SOQL query that will give me contact and opportunity information from people in a specific campaign. I have done the following and I can get Contact information, but I am not ...
1
vote
1answer
28 views

Unit Test - Flow Variable to Apex Class to HttpRequest

For context, I am usually just a declarative Admin and can usually achieve whatever I need to on the platform using Flow, PB, or simple WFR. Very seldom do I have to 'resort' to Apex. I have a Flow ...
1
vote
0answers
32 views

Testing Batchable with Callout Error: You have uncommitted work pending. Please commit or rollback before calling out [duplicate]

I have a Batchable class which does a callout. When I test the class which like this: Test.startTest() MyBatchableJob job = new MyBatchableJob(); Database.executeBatch(job, 50); Test.stopTest(); I ...
0
votes
0answers
37 views

Variables from inner class defined by JSON deserialization are coming across as null

I have a class, geolocAddress, that I created to deserialize some JSON using JSON2Apex. I really only need to access the variables from one inner class, Components, but when I try to retrieve the ...
-3
votes
1answer
86 views

Callout from Trigger using future or queueable [closed]

I have trigger on custom object and i need to make callout (Post) from trigger whenever status field change to completed I know i can do this using @future in trigger but my requirement is if response ...
0
votes
0answers
34 views

Quickbooks API PDF upload error: Maximum line length limit exceeded

I'm trying to upload pdf file from Salesforce to Quickbooks attachments via Quickbooks API. It works fine with small files, but if file size exceeds 999 bytes, the following error appears: An ...
0
votes
1answer
29 views

Batch callout: How to upload Attachments from multiple objects (dynamically)?

I am trying to upload an Atttachments based on the selection and criteria from Lightning Component that will be saved to Custom Setting. For example, the criteria is Opportunity - Stage - Closed Won, ...
1
vote
1answer
45 views

Callout from trigger is not Supported

I am trying to execute a callout from trigger. But i got as error in the debug log as "common.apex.runtime.impl.ExecutionException: Callout from triggers are currently not supported." I know we ...
1
vote
1answer
28 views

Batch method making callout: uncommitted work pending

My app is an SMS lightning component, so in many situations, I'm doing DML updates AND making a callout. I have avoided the "uncommitted work pending" errors by using @future (callout=true) on all the ...
0
votes
0answers
15 views

Test batch with multiples Callouts - HTTPMock [duplicate]

I have a Class that integrate Api , there are many Callouts in there. And I have a Batch Class that running on functions of this class. My question is about the test class. test class: @...
3
votes
1answer
62 views

Using Named Credentials in OAuth 2 authentication (grant_type=password)

I want to get an access token from an external endpoint (HTTP callout to REST API) without hardcoding passwords. The external system expects a request with Oauth 2.0 authentication details provided in ...
0
votes
0answers
23 views

How to fix callout error — You have uncommitted work pending. Please commit or rollback before calling out? [duplicate]

I'm doing an upload attachment to AWS, but I'm getting this error -- 'You have uncommitted work pending. Please commit or rollback before calling out' How do I fix this? @AuraEnabled public ...
1
vote
1answer
56 views

How to do this 'GET' through Batch?

I have a void callout class. But I need take all these tools through Batch to make it in Schedule later. How can I convert it into Batch structure with start, execute, finish? public static void ...
1
vote
1answer
34 views

Sending multipart data throws error?

I am using exact answer from this link, just with some minor modification. Post multipart without Base64 Encoding the body I have developed a spring boot application which accepts two formdata, one ...
-2
votes
1answer
55 views

Apex Trigger to callout Rest API to external system when the status is updated

I have a REST API class which will send the response to external system as { "AccountId" : "0098", "email" : "Email-ID", "status" : "active" } Below is the REST API class that will send data to ...
0
votes
0answers
23 views

Problem calling specific variable of a json

This is my Invoicewrapper class that is working perfectly fine: public class InvoiceWrapper { public class Counts { public Integer returned {get;set;} public Integer total {...
0
votes
1answer
85 views

Calling a Batch Class from Lightning component [closed]

How can I call this Batch Class from Lightning component? global class BatchSync implements Database.Batchable<sObject>, Database.AllowsCallouts { public String query = 'Select ID, Name ...
1
vote
1answer
33 views

lightning:empApi and Callout: Streaming API

I created a test platform event with checkbox, added my custom object to Change Data Capture and did this: empAPI.cmp: <aura:component implements="flexipage:availableForAllPageTypes" access="...
3
votes
2answers
92 views

Let external system modify Salesforce data on behalf of logged in user

I am going to build a native Salesforce app (Managed package) that will be installed in many subscriber orgs. The app will make callouts (eg. calling REST endpoint) to external Java app. The Java ...
0
votes
1answer
28 views

Callout conflicting with Messaging in batch job

I have a service that is making callouts to another system and if it fails for some reason send email notifications. When I do the service for one record it is fine (e.g. call it from a trigger). ...
0
votes
0answers
40 views

Avoid Using Hard Coded Credentials for Authentication

We have done the code review by salesforce,and got "Avoid Using Hard Coded Credentials for Authentication" at quite some places where ever we are setting up Authorization Header.(On the 5th line of ...
2
votes
1answer
68 views

Deserialize api callout problem

I am facing a problem which I am not finding any answers. I am trying to call a third party API (which is working). But when I try to deserialize the json receive, nothing is happening. Here is my ...
0
votes
0answers
16 views

Implementation approach suggestions for a realtime Callout

Our data model for Contract is like below: Contract Contract Line Item (Each Contract Line Item corresponds to an Opportunity Line Item) Each Account(Customer) is associated with a Contract ...
0
votes
1answer
54 views

STATUS_CODE returned for the response: 403 STATUS_MESSAGE returned for the response: Forbidden

Can someone please guide me how to resolve the access forbidden 403 status code error ? What can i do to at least hit the end point? I am executing the code anonymously in developer console string ...
0
votes
1answer
45 views

How to deserialize the following JSON to get the list of values? [duplicate]

I have used the code below to deserialize the json but throwing an error. Map<String,Object> root =(Map<String,Object>)JSON.deserializeUntyped(res.getBody())); "Callout error Invalid ...
0
votes
1answer
43 views

Consuming a REST api in Salesforce

I need to create an integration between Salesforce and a third party service. Essentially Salesforce will trigger a callout to the third party when a status change occurs on a custom object record. ...
3
votes
1answer
62 views

Read Time Out - First HTTP request - rest

Http request using restAPI : public static String sendFormHttp(Opportunity opportunity, List<Easy_Send_Form_Mapping__mdt> mappingList, Map<String, String> systemVariableMap){ ...
5
votes
1answer
203 views

AWS Signature Version 4 Using Named Credentials

Anyone tried Summer '19 Named Credentials using AWS Signature Version 4 successfully? Trying again to use External Services and first step is the Credentials. I created an IAM user with the ...
0
votes
1answer
45 views

caseId property is not shown in response received from a external service to Salesforce [closed]

I am making a POST callout from salesforce to another service and case is one of the objects of JSON which i am sending (see below) "case": { "caseId": "00000212", "status":"", "statusReason"...
0
votes
1answer
32 views

Batch with multiple callout to get record

Is it possible to create a batch class that makes x calls to take n records at a time and run the dml of these records? For example. I call the service. I read the first 200 records and do dml, then ...
0
votes
1answer
29 views

How can I do a 2-way real time sync with large data sets from external database to Salesforce

I have a requirement where I have to do a real time sync with an external database and salesforce. Objects that I need to sync Contacts, its notes and events. I have used Bulk API previously to push ...
-1
votes
1answer
68 views

TestMethod do not support getContent call [duplicate]

I have a requirement to send a specific report as an attachment on schedule basis. So, i have created a schedule class with future annotation to send.But now when i'm trying to setup apex class I'm ...
4
votes
1answer
175 views

Enqueue Queueable class multiple times

I need to do five different callouts from my trigger. I'm planning to use one Queueable class for all the callout using the parameter passed in the constructor. I'm not sure if it is possible, if it ...
0
votes
2answers
78 views

Using REST to update Salesforce record from Salesforce

I am trying to update a Salesforce record but I have to update it using an older version of Salesforce API (v44) due to some new standard behavior changes salesforce made. I am doing this by making a ...
0
votes
1answer
17 views

I'm getting an error “Unknown property 'PDSrestCall.userProfile.ibmUniqueId'”

I'm trying to display my deserialized JSON on my VF page but I get Unknown property 'PDSrestCall.userProfile.ibmUniqueId' Help Please. PS i removed the API endpoint for security purposes. Here is my ...
0
votes
1answer
49 views

Flow and synchronous callout

we have a flow where the user can enter data to create a record of a custom object. That works fine. But requirement is that new record must be transmitted to an external system and user should get ...
1
vote
1answer
67 views

How to pass an attribute to XML message in SOAP webservice callout

I have a WSDL that I have imported in Salesforce and parsed using the WSDL2APEX option . It generates a sample message like below. <LineItems> <LineItem> <...