Questions tagged [httpresponse]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
195 views

I am downloading the attachments via REST API in postman. I am getting response as below but I would like know which format it is?

We are providing service to a external system, they need to convert the response to a .xlsx file. They are asking about the format.can any one help me in this?[
KCompany's user avatar
1 vote
2 answers
179 views

Bulk API Query Job in Apex with big response

I have a task to query a million records from one org and then upsert them in another org. I use a Bulk API query job to get all records. HttpRequest request = new HttpRequest(); request.setEndpoint('...
Marina's user avatar
  • 11
0 votes
1 answer
61 views

Reply to Trustpilot Review Service Reviews API returning 400 Bad Request

This is my code in Salesforce HttpRequest req = new HttpRequest(); req.setEndpoint('callout:TrustPilot/private/reviews/'+reviewId+'/reply?token='+token); req....
Bestina Rajasingh's user avatar
0 votes
1 answer
1k views

How to check if a http response is null when it is an empty object and status code is 200?

Im making a POST to an endpoint and this is what I get back in my response, its a successful POST and the status is 200 but the payload is empty. { "payload":[], "datetimestamp"...
potato46's user avatar
1 vote
0 answers
278 views

How to set the statusCode and message of a rest api call from an autolaunched flow?

I have an autolaunched flow that I'm invoking with a rest api call. Here's the sample code that shows how I call my flow from an express.js server. var _request = { url: '/services/data/v54.0/...
Bahman.A's user avatar
  • 808
0 votes
1 answer
172 views

How to prevent user from re-clicking a button to submit input fields until API sends a response to a Callout?

There is a Salesforce UI built using Visualforce and Lightning Aura Framework. There are 3 input fields. On clicking of a button we want the values of the input field to be sent to an external API and ...
Amax1's user avatar
  • 109
0 votes
2 answers
35 views

Retrieve data from 2nd SF Org

I'm making a SF org where i need to retrieve data from a 2nd SF org. I have created Connected App in my Source Org, and i have created Auth. Provider and Named Credential in the Portal Org (that the ...
JonasH's user avatar
  • 1
0 votes
1 answer
848 views

How to replace multiple reserved attributes in JSON response in apex?

My JSON response in my apex class has a reserved keyword and couple of other supported names, I have been using the following getData = (infos)System.JSON.deserialize(res.getBody().replaceAll('"...
Cathy's user avatar
  • 73
0 votes
1 answer
3k views

HTTP response content showing null value when using Script.Util.HttpRequest

I'm trying to create an SSJS script that can store the values in the marketing cloud's database using the Script.Util.HttpRequest method. When I try to print the HTTP response content, I get a null ...
Harshit Singh's user avatar
1 vote
1 answer
557 views

REST Request is rejected since Winter 23 hit the preview enabled sandbox

REST Requests seem to be rejected by SF since Winter 23 hit our preview enabled sandbox. Below sample code runs (run on Exec. anonymous) smoothly in v54 sandbox, but fails with below error in v55 (...
Pasan Eeriyagama's user avatar
1 vote
1 answer
570 views

Parsing HTTP JSON Response [duplicate]

I'm pretty new to Salesforce/Apex and I'm trying to extract the information I need from the HTTP API call I make to an external system (like Piwik.pro) and store in list or a map. I want to get all ...
Stojchesky's user avatar
1 vote
1 answer
491 views

how to fetch and store http response coming as object(not sobject) [duplicate]

I am fetching these(Actors, awards, genre, lanuage) details from htpresponse "results" of an api. But these values are coming as object. I want to show these values on Salesforce UI. since ...
vchitlangia's user avatar
0 votes
1 answer
629 views

LWC - Checkbox json data response help

So, these are the checkbox that I'm testing. What I have - A function that are associated with uncheck/readonly, and some of my json catch response try. What I need to do - I need to catch the json ...
Ian Lee's user avatar
  • 117
0 votes
1 answer
634 views

Parse multipart/form-data response in salesforce

I want to parse multipart/form-data response in salesforce using apex, my response sample is below. do I need to parse it with some algorithm or there is any built-in library or method available. -----...
shajji's user avatar
  • 111
0 votes
1 answer
539 views

Salesforce Apex Api is Returning response with Escape Character

Salesforce Apex Api is Returning response with Escape Character in Postman public class ResponseWrapper{ public string id; } ResponseWrapper responseWrapper = new ResponseWrapper(); ...
user3444999's user avatar
0 votes
1 answer
321 views

Getting this error "System.JSONException: Malformed JSON: Expected '{' at the beginning of object" due to response body , pl help me if anyone knows [duplicate]

We are getting below Json format as response and storing into Respbody variable . But when we are deserializing that we are getting below error: error : System.JSONException: Malformed JSON: Expected '...
Nagarjuna's user avatar
0 votes
2 answers
106 views

System.CalloutException when doing HTTP response [duplicate]

I keep getting System callout error when updating a contact field for multiple contacts. System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out ...
Ken Maranion's user avatar
0 votes
0 answers
438 views

String concatenation of endpoint modify the comportment of a Get request

string id = '12345'; // will be set dynamically string endpoint = 'https:/sameEnpoint/leads/' + '12345'; //opt1 string endpoint = 'https:/sameEnpoint/leads/' + id; //opt2 string endpoint = 'https:/...
Jojosfdc's user avatar
  • 448
0 votes
2 answers
2k views

Missing return statement required return type: System.HttpResponse

I'm going through this trailhead module and, as a good newbie, I'm experiencing some issues in completing the hands on challenge. This is my AnimalLocator class: public with sharing class ...
robruf's user avatar
  • 362
1 vote
0 answers
77 views

Parsing of Json response from Tooling API code [duplicate]

Please have a look through the attached debug log Below is my code:- Apex Class:- Http http = new Http(); HttpRequest request = new HttpRequest(); request.setEndpoint(Url....
SFDCTashan's user avatar
0 votes
1 answer
675 views

How to manage both single and an array of json reponse from the same external system?

I have a situation where when I make a callout I get a single json response like this: { "Person": { "Infomration": { "IndividualInformation": { ...
nSv23's user avatar
  • 544
1 vote
1 answer
713 views

Make HttpRequest Callout to send binary data without corruption

I faced issues when tried to send binary data from Salesforce to external web services. To start with, I tried to send binary data from Salesforce to itself. I am trying to read binary data from valid ...
Patlatus's user avatar
  • 16k
0 votes
2 answers
1k views

How to handle null keys in JSON response?

I have a json response class like this: public with sharing class Response { public Person person; public class Person { public PersonData personData = new PersonData (); ...
nSv23's user avatar
  • 544
1 vote
1 answer
2k views

SSJS: read response headers from Script.Util.HttpRequest object in SFMC

We need to retrieve the response headers from an HTTP GET call issued in SSJS with the Script.Util.HttpRequest function. Unfortunately, even though it seems straightforward and the task itself is ...
jackal992's user avatar
2 votes
1 answer
1k views

Details for function Script.Util.HttpResponse

Can someone provide example code for the function Script.Util.HttpResponse or point to a better resource than these help docs?
Will's user avatar
  • 184
0 votes
0 answers
37 views

Malformed Json Error on http request [duplicate]

Hey all I am getting an error and cannot for the life of me figure out why. Thanks in advance for help! Error is: Failed to invoke future method 'public static void pushToLead2(String)' on class '...
Johnie Waddell's user avatar
0 votes
1 answer
446 views

System.JSONException: Malformed JSON: Expected Error when try to deserialize json

When I try to deserialize the JSON response I am getting 'System.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set' Json Response body is "[{\"ExternalId\":\"...
Anu's user avatar
  • 3,817
0 votes
1 answer
97 views

Problem with testing void HttpRequest

I can only get 23% code coverage with what I have. The http request in the method is not getting covered for some reason.. Here's what I've tried: Class: public class PostClientes { @...
Josue Rivas's user avatar
2 votes
1 answer
386 views

HttpPost method test will not run: Method does not exist or incorrect signature: void doPost() from the type MyOriginalClass

I have a test like below. and the error: Method does not exist or incorrect signature: void doPost() from the type MyOriginalClass In MyOriginalClass, the method has parameter like doPost(String url) ...
rosa's user avatar
  • 21
0 votes
1 answer
684 views

500 error Marketing Cloud API - Deleting Contacts

Given a successful authorization, the following API call fails with 500 POST /contacts/v1/contacts/actions/delete?type=keys Body: { "DeleteOperationType" : "ContactAndAttributes&...
cropredy's user avatar
  • 69.9k
0 votes
1 answer
74 views

Error Invalid Conversion from runtime JSON to APEX

I am getting an error while converting the response from JSON to Apex class. Invalid conversion from runtime type MapAPIDemo.resourceSets to List<MapAPIDemo.resourceSets> Here is the code below ...
Shantanu Mahajan's user avatar
3 votes
0 answers
1k views

Executing multiple callouts from a future method

I have a problem when I try to execute multiple callout from a method of an Apex Class. The method code is the following: @future(callout=true) public static HttpResponse makeCallout(){ List<...
Valentina's user avatar
0 votes
2 answers
3k views

JSON deserialize test

In normal runtime everything seems to deserialize correctly but when I try to run a test class it throws the following error: System.JSONException: Unexpected character ('r' (code 114)): was ...
Daryn's user avatar
  • 251
1 vote
3 answers
47 views

How do you map a HTTPResponse with repeating data

I am trying to map the response from an API call. The call is as follows: public Void Jetnet(){ String SecurityToken = JetnetAPI_SecurityToken(); HttpRequest req = new ...
Bradley Smith's user avatar
1 vote
1 answer
49 views

Capturing HttpResponse StatusCodes

I'm trying to capture a HttpResponse StatusCode in a @future method so I can then send it to an email to alert a dev of a possible issue and also alert the Salesfroce user of the error. I have found ...
Richard's user avatar
  • 165
0 votes
1 answer
1k views

Response to Http request - response

I'm making integration to an external system and send them a request, and I get a JSON as a response via REST API. The response has a lot of data to upsert to SF. While upserting the Data inside the ...
Salvation's user avatar
  • 1,147
0 votes
1 answer
2k views

how to query job batches info bulk api 2.0

Before, using bulk api 1.0 endpoint. I could make request to get all job's batches like so: ` req.setEndpoint('callout:BulkApi' + '/' + jobId + '/batch'); req.setMethod('GET'); req.setHeader('...
Master Przemo's user avatar
0 votes
1 answer
145 views

deserialize a JSON and modify a single attribute in the list of Object

I have a JSON string as below from a http response. { "agreements": [ { "agreementId": "ag0", "publishedDate": "04-03-2016 00:00:00", "AgreementNumber":...
Sisir's user avatar
  • 101
-2 votes
1 answer
2k views

Parsing JSON response giving null pointer exception

I'm trying to retrieve a couple fields from a json and put them into an existing account. Im starting out with just one account right now but would like to eventually pull a list of accounts and ...
Tyler's user avatar
  • 91
1 vote
0 answers
175 views

Failed to get success response in “application/json” using Name Credential

HttpResponse in “text/html” instead in “application/json” if using Name Credential Step1 : Name Credential Step 2: Authentication & Authorization Code RESPONSE header>>>>>: ...
Asif Khan's user avatar
0 votes
1 answer
919 views

Get data from multi level json string

I am getting some data in response to my code which is a JSON string as: HTTPResponse res = {"id":2048,"extension_attributes":{"stock_item":{"stock_id":1}}} Now to retrieve data, I've done Map<...
Anant's user avatar
  • 133
0 votes
1 answer
68 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"...
SunnyG's user avatar
  • 421
1 vote
0 answers
85 views

Getting an PDF from external webservice and store it as attachment creates empty pdf

I have to get a pdf from an external web service and store it as an attachment of an object. Im getting the pdf with the following code public override Blob getPDFReport(String token, String jobId) {...
DCaballero's user avatar
0 votes
1 answer
862 views

Bulk API 2.0 Close Request Failing - Cannot specify query parameters in the resource

I am doing a POC on the BULK API and have run through this trailhead: https://trailhead.salesforce.com/en/content/learn/modules/api_basics/api_basics_bulk where you call the BULK API through WorkBench....
MR.M.'s user avatar
  • 93
0 votes
1 answer
297 views

JSON response structure change

JSON response from the callout is changed. 1) Current JSON response : { XYZ { } DEF { } MNO { } } Now its changed to : { ABC_Stage{ XYZ{ ...
Manish Anand's user avatar
0 votes
1 answer
1k views

HTTP request to return a list of Contacts

I would like to change the following method within this class: public class ApexCalloutsDemo { public static HttpResponse makeCallout() { Http http = new Http(); HttpRequest ...
Andrea Voggenreiter's user avatar
1 vote
0 answers
938 views

HTTP GET Response with 204 Status Code and blank Body [closed]

I send Callout request to ActiveMq messages queue service to get messages form there and handle it in Salesforce. In the Queue there are 3000 messages. When I send the request from salesforce sometime ...
AZIZ's user avatar
  • 11
0 votes
1 answer
960 views

Is a Request possible without a Response Status?

Utilizing a custom salesforce connect adapter, callouts are being made using the HTTPRequest and HTTPResponse classes. 40,000 requests to these webservices are being made and all but a few (2-5) are ...
S.B.'s user avatar
  • 2,039
0 votes
1 answer
2k views

How to redirect to external url from apex from callout response

I have a class from which I do a callout in apex. After the response of the callout I want to redirect the user to an external url how can I achieve this?. I have only been able to redirect ...
Thomas's user avatar
  • 2,294
0 votes
1 answer
1k views

How to read the error from the response given by Salesforce

I have an api that has a catch method: catch (Exception e) { // Error System.debug('API - ERROR: ' + e.getMessage()); res.responseBody = Blob.valueOf('ERROR: ' + e.getMessage()); res....
BlondeSwan's user avatar
  • 1,078