Questions tagged [httpresponse]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
8
votes
2answers
3k views

How to handle an HTTP response time beyond two minutes?

The maximum value for HttpRequest.setTimeout function is two minutes. How can we design an Apex class to receive the response if the response time is always guaranteed to be more than two minutes? In ...
8
votes
1answer
801 views

HTTP Callout Problems in Pre-release

I am running the same code in two different environments and I am getting different results. I have the following code hitting the REST API exposed on StackExchange: Http httpQuestions = new Http(); ...
7
votes
2answers
5k views

HttpCallout resulting Html response instead of JSON

I am trying to make a httpcallout to "https://www.carrierlookup.com". When I tried it with browser's apex rest client extension it returned correct response : {"Response":{"creditBalance":"985","...
7
votes
1answer
4k views

You have uncommitted work pending. Please commit or rollback before calling out

I have written a callout class as below.But when a account is created/updated am getting the exception like "You have uncommitted work pending. Please commit or rollback before calling out" at 36 line(...
6
votes
1answer
4k views

RestResource Class: Set the HTTP Response Status in APEX

We have exposed an Apex Class as a Rest Resource. It is a HTTP Post class and broadly it has the following logic: Get parameters to create a new Account Validate if existing database if it is a ...
6
votes
1answer
4k views

how to get test coverage for @future and http response method in class

Below is my apex class and trigger, that is used to send sms from 3rd party application and that is working fine, but i'm not getting test coverage for class. If i use @future method my apex class ...
6
votes
1answer
1k views

HttpOnly Cookies Not Available in Apex

When making an HTTP callout using HttpRequest, Set-Cookie headers returned with the HttpOnly flag are not included in the HttpResponse. This appears to be consistent with RFC 6265: The HttpOnly ...
6
votes
0answers
149 views

API request/response codes when site is in read-only maintenance mode?

I checked out Read-Only Mode Overview but I'm still unsure of how our API will respond, particularly the response code. Will POST/PUT requests automatically return a 503 service unavailable or will ...
5
votes
1answer
3k views

Is it possible to read cookie while doing a HTTP Get to external website?

Well was wondering if this is possible at all ? The aim is to get a cookie from an external website. But while going through the HTTP class for both Request and Response I don't think there is a ...
4
votes
3answers
42k views

Missing SOAP action header

Im trying to get the session ID of another user in the same org by sending the following request by using the data from my enterprise wsdl and its an developer edition. <?xml version="1.0" ...
4
votes
1answer
2k views

How to solve “First error: connection was cancelled here” error in batch apex [closed]

I have a batch apex class that makes an http (GET) callout to external api from salesforce. It returns x number of JSON objects which are decoded to create lists of cases but the dml upon insert never ...
3
votes
1answer
7k views

How to set timeout for web service call

I want to call out my web service after the insert process of a custom object with a delay of 2 minutes. But i am getting that exception FATAL_ERROR|System.CalloutException: Read timed out How can i ...
3
votes
1answer
2k views

Parse JSON Response and add to Visualforce Page

I have this JSON Response, and I'm having trouble trying to figure out both the JSON.deserializeUntyped and JSON Parser. My ultimate goal is that I need to parse the JSON, then take each value and ...
3
votes
1answer
213 views

HTTP call using Salesforce

I am trying to rewrite the following Java HTTP request in Salesforce. String apiUrl = "url"; String wsUser = "YourWSUser"; String wsPassword = "YourWSPassword"; CredentialsProvider ...
3
votes
1answer
11k views

HttpResponse body is empty even on successful request

I am doing a Http request to a web service and I get status 200 success. However when I try to read the response body (response.getBody()) it comes as empty. When I do response.toString() I get ...
3
votes
2answers
823 views

HTTP GET Response into PageReference

I'm calling an external endpoint which send back a pdf report as the response. Request should have some header info as well so thinking execute the request in the controller. But how is it possible to ...
3
votes
1answer
2k views

Changing HTTP header code in POST response

I've been doing some research on this issue, but I haven't been able to find a solution. I'm trying to return HTTP 403 after failing to validate some information sent in a POST request to Salesforce. ...
2
votes
2answers
5k views

APEX FATAL_ERROR System.CalloutException: Read timed out

I'm trying to make future callout from an Apex trigger to POST to an external webservice URL but getting a Read Time Out error. Here are the issues: Why is the JSON not forming from the serialize ...
2
votes
1answer
3k views

Verify getChildElement() is not null

As a follow up to my previous post: REST API calls to 3rd Party (Pardot), multiple @future callouts There are two responses I expect back when I attempt this Web Service callout to Pardot: 1) ...
2
votes
1answer
287 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 ...
2
votes
1answer
152 views

Downfalls to using HTTPGet() to see if an asset exists

I'm thinking of using the HTTPGet() function in the following Ampscript of an email... var @ItemId, @ItemAsset, @ItemAssetCall, @ItemAssetCallStatus set @ItemId = '1234' set @ItemAsset = ...
2
votes
1answer
425 views

How to get raw response from .NET force.com toolkit when using QueryAsync

I am struggling to find out why my query throws an exception when I do a specific query. Is there a way to see the raw response from Salesforce or .NET? Query string in itemQueryString is running ...
2
votes
1answer
804 views

How to Create Records from XML Data?

This is the webservice response I am Getting in XML Format. <?xml version="1.0"?> <ListOrdersResponse xmlns="https://mws.amazonservices.com/Orders/2013-09-01"> <ListOrdersResult> ...
2
votes
1answer
60 views

batch fired callout only received response from last callout

So my batch will collect 843 records, for each batch, which is 200 records, i constructed a json and made the callout, so in total, it is 5 batches and 5 callouts. I have a server hosting my rest ...
2
votes
2answers
2k views

HttpResponse StatusCode=200, but 3rd party request (Pardot) not made

ObJective: I am attempting to create a new prospect in Pardot when a lead that had no email gets updated with an email (Pardot will sync accounts but until the lead email exist there is no prospect to ...
2
votes
0answers
178 views

pdf not downloading properly

I have these lines of code: public String getCoverPdf() { if(!String.isBlank(pdfLink)) { Http h = new Http(); HttpRequest req = new HttpRequest(); ...
2
votes
0answers
65 views

Fetch Data of Different Organization?

I have 2 Orgs- Org A & Org B both are ap1 Instance In Org A I've created a Connected app In Org B I am trying to Query accounts of Org A From the Connected App Through Http Call, but I am ...
2
votes
1answer
615 views

Pulling in external HTML content into an email

I have been able to successfully pull in content using HTTPGET, but I only see the AMPScript when I view in Email Overlay view (under tracking reports) %%[ var @getStatus, @getURL, @content set @...
2
votes
0answers
2k views

Calling a web service from a Visualforce page using jQuery Ajax

I want to call a web service using REST API from the Visualforce page. Below is my code. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js">&...
2
votes
0answers
161 views

Identifying Post back or not

Is there a standard way to identify a post back in apex?(something like IsPostBack in asp.net? ) For a oauth flow I'm handling this with the controller constructor like public class DeveloperTesting{...
2
votes
3answers
870 views

Sending attachment to JIRA From Salesforce Issue

I am trying to upload to JIRA from SF. I am using below code. HttpRequest req = new HttpRequest(); HttpResponse res = new HttpResponse(); Http http = new Http(); Blob headerValue = Blob....
2
votes
0answers
452 views

http mock for dom document

I am using http mock method for testing responses. But as one of the class expects DOM document and use response.getBodyDocument(). Usually, I used to insert sample response for http mock. I am ...
1
vote
1answer
3k 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 ...
1
vote
1answer
4k views

How to work with HttpResponse?

I am able to do a successful callout and get the response just fine. Having issues referencing the data inside the response.getBody(). What method do you use to be able to reference the data sent ...
1
vote
3answers
1k views

Download files from Google drive

https://developers.google.com/drive/web/manage-downloads In the above link it is given that we have to make a GET request to the downloadUrl (which we get in the response when we upload the file) in ...
1
vote
1answer
641 views

Having trouble deserializing a JSON string of Objects

I'm trying to handle a JSON response..the format it comes in is not the best but I can't change it..Ive used JSON2APEX and can access the object values individually but I need to loop through them ...
1
vote
1answer
896 views

JSONParser.getText() results in null but not interpreted as null in if statements

I am parsing JSON that has field 'next_page'. If this field is null, I do not want to enqueue another HTTP request to fetch that page. However, in this code, parser.getText() is debugging as null, ...
1
vote
1answer
110 views

HTTP Request Ignoring Body

I have written a trigger that parses url's stored in a number of objects and requests them to see if they are still valid. private Boolean pollserver(string url, string referer) { ...
1
vote
1answer
167 views

Can successfully send GET request to Chatter API but not POST, receiving INVALID_SESSION_ID

I never had this issue using the REST data API - I'm using the Chatter API and trying to post to a group. I am setting the correct instance url in the request, and passing the returned access token as ...
1
vote
1answer
24 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 ...
1
vote
1answer
1k 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
2answers
1k 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 ...
1
vote
1answer
401 views

Http request not returning token through Apex

I am trying to communicate with an API through Apex, the parts of the API I wish to access require an access token acquired using OAuth 2.0. I have created a method that will access the endpoint and ...
1
vote
1answer
143 views

Why do I get “method doesn't exist or bad signature”?

What am I doing wrong here? I have an ApexClass named SearchController, which starts with: public class SearchController and which includes these two methods: public void save_search_results(...
1
vote
2answers
415 views

I am calling a web service while clicking on a link , but I am getting status code 401 error. Please let me know the fault

Global class TestCmis{ Webservice static void getCmis( Id LeadId){ system.debug('HAnana---->'); HttpRequest req = new HttpRequest(); req....
1
vote
1answer
656 views

Header names appear to be case-sensitive in HttpResponse

I've got NullPointerException trying to analyze the value of content type header returned in HttpResponse object. As it turns out, the case of the header name was different (i.e. 'content-type', but ...
1
vote
2answers
901 views

Separate base64 images received in HttpResponse

I am receiving a bunch of images together in base64 format in a HttpResponse. I am querying my java heroku app which returns a response something like this: [imgData]{base64image}[/imgData]/n [...
1
vote
2answers
1k views

Is it possible to add http headers. for example set-cookie, via ampscript or ssjs in ExactTarget?

I would prefer not to use javascript to set a cookie if possible. I am pretty sure it's possible to read a cookie using HTTPRequestHeader(S1), but I'd like to be able to set one when a user submits a ...
1
vote
1answer
2k views

How to get Json response without rest api and parse the response in objects

I need to get json response and parse the response into the object(Without using http callout).I need to have application(class) which can get response from other callback url and parse that response ...
1
vote
2answers
955 views

HTTP POST callout not showing response body

I am making a HTTP POST callout from Salesforce. I am getting a HTTP 200 response code from the remote server but I am not getting the response body in the response. However, when I am using the same ...