Questions tagged [httpresponse]
The httpresponse tag has no usage guidance.
127
questions
1
vote
1
answer
51
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 ...
0
votes
1
answer
91
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 ...
0
votes
1
answer
120
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.
-----...
0
votes
1
answer
91
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();
...
0
votes
1
answer
64
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 '...
0
votes
2
answers
59
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
...
0
votes
0
answers
44
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:/...
0
votes
2
answers
256
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 ...
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....
0
votes
1
answer
68
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": {
...
1
vote
1
answer
175
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 ...
0
votes
2
answers
357
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 ();
...
1
vote
1
answer
864
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 ...
2
votes
1
answer
605
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?
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 '...
0
votes
1
answer
169
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\":\"...
0
votes
1
answer
44
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 {
@...
2
votes
1
answer
253
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) ...
0
votes
1
answer
307
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&...
0
votes
1
answer
45
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
...
3
votes
0
answers
797
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<...
0
votes
1
answer
340
views
What will be the value of Status code and status in this http response?
I have been shared with the below http response. I read the apex http response docco, however still confused what would be the value when I try response_x.getStatusCode(). will it be 503 or 486904? ...
0
votes
2
answers
1k
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 ...
1
vote
3
answers
35
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 ...
1
vote
1
answer
41
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 ...
0
votes
1
answer
126
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 ...
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('...
0
votes
1
answer
37
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":...
-2
votes
1
answer
993
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 ...
1
vote
0
answers
82
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>>>>>: ...
0
votes
1
answer
556
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<...
0
votes
1
answer
63
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"...
1
vote
0
answers
37
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) {...
0
votes
1
answer
463
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....
0
votes
1
answer
103
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{
...
0
votes
1
answer
630
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 ...
1
vote
0
answers
485
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 ...
0
votes
1
answer
114
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 ...
0
votes
1
answer
1k
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 ...
1
vote
1
answer
552
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....
1
vote
0
answers
994
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
...
1
vote
1
answer
9k
views
System.StringException: Unrecognized base64 character: \
I am trying to parse the response body which is in "base64 content of a file" and trying to create the attachment with the body but getting error of " Unrecognized base64 character: \" I have included ...
2
votes
1
answer
775
views
How to make HttpGet service pagination with a limit of a million or more?
Offset can take only 2000 records, but I need more. How can I send to the callout side 1 mln or more records with pagination and step of 100-200 records per 1 page? I mean when callout request for 100 ...
1
vote
1
answer
3k
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 ...
0
votes
2
answers
196
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
1
answer
102
views
System.NullPointerException: Attempt to de-reference a null object Error while parsing XML response
I am trying to parse the XML response and want to create the records only when url is present but when i am trying to create the record then i am getting the below error "Line: 83, Column: 1
System....
0
votes
1
answer
46
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 ...
1
vote
2
answers
4k
views
a way to return value from @future method
I have a situation where I have to insert data into a wrapper class and a bunch of objects to save in Salesforce first and then make an API call.
As we know, salesforce will not allow us to make any ...
0
votes
1
answer
1k
views
Malformed JSON: Expected '[' at the beginning of List/Set\n\nClass.System.JSON.deserialize
Through the Http response I will get the output like below.
[{"CourseType":"OnlineCourse","Id":"05f932c9-1059-4495-87d9-2e7a09bd3930","Name":"Fundamentals
of Contact Lenses","Description":"This ...
1
vote
2
answers
5k
views
Retrieving csv document using HTTPRequest
I'm working on a project to
retrieve/GET a csv file using an HTTPRequest
update the associated Salesforce records, and
POST a csv back
I found this 'send a report as a CSV/TEXT' thread, which looks ...