Questions tagged [http]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
33 views

setting a large http body

I am trying to send a http request with a large string Body; however, salesforce complaints about the size of the string, the error as follows: caused by: System.StringException: String length ...
10
votes
1answer
6k views

apexrest: controlling HTTP error codes on exceptions

Is it possible to control what HTTP error code apexrest returns when an exception occurs in the code? By default it returns a 500 error and a developer who's working on the system that's consuming ...
1
vote
1answer
35 views

Error when pulling PDF from HTTP response

I have a question regarding this post: handle PDF content in HTTP callout When I try the above code I'm getting this: "Unrecognized base64 character: %" The logs show this as well: 19:53:04:658 ...
1
vote
1answer
90 views

SSJS HTTP Get method error - Unable to retrieve security descriptor for this frame

I am trying to retrieve a template-based email asset using the Content Builder API via a Cloud page. I am having trouble retrieving the template. I am not sure if it is an issue with the structure of ...
1
vote
3answers
155 views

Make http callout in batch after insert actions

I have a batch job with http callout enabled, in the execute() method, the code logic goes like: global void execute(Database.BatchableContext BC, List<Object> scope){ List<CustomObject&...
0
votes
1answer
38 views

not able to access the variable values after using the continuation class

private class StateInfo { Account acc {get; set;} StateInfo(Account acc){ this.acc = acc; } Contact cont {get; set;} StateInfo(Account acc, ...
0
votes
1answer
951 views

External image not displaying in community

My problem is that I cannot view an image loaded from an external site into an img tag in my lightning component. The URL is with 'http' protocol not 'https', but when I see the Chrome Console, it ...
1
vote
1answer
2k views

Trigger to use HTTP callout and update record with the results

I have been trying to integrate Google Shortener API into my salesforce org. I wrote a class to make the call out, but am having difficulty bringing the value back into the record. I have a custom ...
1
vote
0answers
33 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
80 views

HttpResponse with status code 0 [closed]

I am using an API to get some response. When I check my HttpResponse. It is like this: System.HttpResponse[Status=null, StatusCode=0] In what case we get such a response?
1
vote
0answers
31 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
0answers
56 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 ...
3
votes
1answer
320 views

System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out in test class

I am facing this issue in a MockCallOut for http in test class. I know that a dml is not allowed just above the callout, so I have tried to put callout between Test.startTest() and Test.StopTest(); I ...
2
votes
1answer
202 views

REST GET API response does not contain null fields

I have written a REST API endpoint for Account object for GET operation. The code is below - @httpget global static list<Account> doget(){ RestRequest req = RestContext.request; RestResponse ...
2
votes
2answers
5k views

“message”:“INVALID_HEADER_TYPE”,“errorCode”:“INVALID_AUTH_HEADER” received

I am trying to call a rest resource within the same org (Because I am inserting records of an object developed by 3rd party and they strongly advised us to not do any DML directly rather they have ...
1
vote
0answers
14 views

HTTPS url for Community isn't redirecting

We are about to launch our Salesforce Community. We created a custom domain and URL using this option for our domain: "Salesforce serves the domain over HTTPS, on Salesforce's servers, using your ...
-1
votes
1answer
463 views

Error while uploading File to S3 from Apex

I am using the below code to upload file to Amazon S3 from Apex class. public void uploadToAmazonS3 () { String filename = this.record.File_Name__c; String attachmentBody = EncodingUtil....
0
votes
1answer
52 views

POST to an external API from visualforce page

I am using OpenCTI in Lightning to enable click to dial. I want to click on the phone number and call an external API to make the dial. I have a visualforce page as CTI Adapter. When the page loads ...
0
votes
1answer
71 views

Saleaforce IOT: ESP8266 IoT device facing 302 Http redirect instead of 201 when calling REST API because of insecure HTTPS call

ESP8266 has been able to get OAuth token by Device Flow OAuth2.0 After getting OAuth token, I was hitting the REST API endpoint /services/data/v45.0/sobjects/Account with a JSON body in the request: ...
1
vote
1answer
1k views

Does HttpRequest.setClientCertificateName always send a certificate?

We are trying to use certificates to authenticate the client (Sales Force) calling our back-end system. However, as far as we can see, SalesForce is not sending any certificate. HttpRequest req = new ...
0
votes
2answers
315 views

PATCH Issue - {“Message”:“The requested resource does not support http method 'POST'.”}

I have a callout that is having an issue with it's POST. I have seen a couple of work arounds for this issue but none of them seem to work with my integration. req.setMethod('POST'); req.setHeader('...
0
votes
1answer
28 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
1answer
48 views

Metadata Rest API for custom objects

Is it possible to create and update custom objects using rest? I seen different questions that suggest it isn't yet available without using a client or SOAP but I need to be able to access it through ...
6
votes
1answer
8k views

What is the difference between webservice and HTTP service?

What is the difference between webservice and HTTP service? I have used HTTP service with REST api. But not able to understand what do we use webservice keyword and what is the difference between ...
0
votes
2answers
355 views

Salesforce server IP which is making callout

I have a batch process which makes a HTTP call out to third party, but because of IP restriction third party is denaying the request. Is there any way to get Salesforce server Client IP from where ...
3
votes
1answer
825 views

Not full URL in Referer header in Visualforce since Spring '17

I have a Visualforce page and controller relying on the HTTP Referer header. ApexPages.currentPage().getHeaders().get('Referer') Before my org was upgraded to Spring '17 this returned e.g.: https://...
0
votes
0answers
168 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 ...
0
votes
1answer
445 views

Secure a Landing Page

I'm trying to have my landing Page HTTPS. In this link https://help.salesforce.com/articleView?id=mc_es_create_landing_page.htm&type=5 it's said that there's a check box where you can select the ...
4
votes
1answer
2k views

Named Credentials - Merge Fields not Resolving

I am having an issue when attempting to reference the {!$Credential.UserName} and {!$Credential.Password} merge fields. I created a named credential with the following configuration: Identity Type:...
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 ...
0
votes
0answers
358 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: ...
1
vote
1answer
1k views

Attempting to pass parameter in request.setEndpoint URL & call through Einstein chat-bot! Is this correct code?

I want to concatenate 'input' variable in the Endpoint URL. If i am passing hard-coded value like 'London', its working properly.(I am getting weather in JSON format back). I want to do it dynamically....
0
votes
2answers
158 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 ...
0
votes
2answers
641 views

Multiple Http Mock Callouts in a single test class

Hi so I'm trying to make a test class for my http callouts class. Now the problem is that I understand that I cannot make multiple DML and HTTP callouts in a single transaction but the third party API ...
20
votes
3answers
4k views

AWS Signature (version 4) in Apex

Over the past few days I have been struggling to create the AWS signature version 4 in Apex to send a request via query string, I have followed the step-by-step instructions for signing aws requests, ...
4
votes
2answers
3k views

Cannot find Data Extension by external key.

I am getting the response from https://www.exacttargetapis.com/hub/v1/dataevents/BBDD0F10-94A1-4CD6-B7A2-32FEB671E44F/rowset { "message": "Unable to locate data extension with ID bbdd0f10-94a1-...
21
votes
2answers
10k views

How can I make a PATCH HTTP Callout from Apex?

I need to make a PATCH http request. I made the rather incredible discovery today that I can't set an HttpRequest to use the PATCH method, as when sending the request I get a callout exception: ...
0
votes
1answer
58 views

Not able to create incident from salesforce to servicenow

I tried the following code to insert incident from salesforce to ServiceNow but not sure what I am doing wrong here, Can anyone guide me what changes needed in this code or do I need to create ...
1
vote
2answers
167 views

HTTP Callout Error using form data format

I am posting the data to endpoint url through http callouts from developer console and getting response "200 ok" and in body of response i am getting an error message of "{"IsSuccess":false,"Message":...
0
votes
1answer
89 views

Convert Multile Objects to a single json

I have a list of map and list objects. These objects needs to be sent as json content in an http request. The objects are Map<String,String> leftFileParameters = new Map<String,String>()...
11
votes
3answers
3k views

How to use HTTPGet variable in URL (ExactTarget)?

Been trying to figure out a way to pass in the variable into a HTTPGet function for long time now. How to do it? Here's what I have so far, but it doesn't return anything. <p id="date" style="...
-1
votes
1answer
128 views

Wrapper class in Http getmethod

below is my code Created a wrapper class like below public class ResponseWrapper{ public list<Account> lstaccounts; public boolean isError ; public string errorCode; public ...
1
vote
0answers
148 views

HTTP GET failing

I have an activity script running a SSJS HTTP GET request. I need to get the output of this request to feed a data extension. I am using this code: var de= DataExtension.Init("dataextension_ek"); ...
1
vote
3answers
1k views

Using Batch APEX to generate template body dynamically with merge field values

I am using Amazon SES to send mails to the all opportunities using batch apex with the body of email template. I'm using the solution proposed in an answer to Using APEX to assemble HTML Letterhead ...
-2
votes
1answer
461 views

Test class for Http Request [duplicate]

I need test class for the below class i have for code coverage. Please help. class and its code is public CodeCoverageController(){ HttpRequest request = new HttpRequest(); ...
0
votes
1answer
31 views

Creating REST Api with little control over request structure

I'm trying to expose a method to be accessed through HTTP Post. @RestResource(urlMapping='/exampleURL') global with sharing class Listener { //Object jsonObj = JSON.deserializeUntyped(...
0
votes
1answer
105 views

Pass value to a visualforce controller from a HTTP Post

I have an iframe that uploads video recordings to a server, when the recording is complete we receive back a call telling us that the video has been uploaded, I am trying to expose a notification on ...
1
vote
1answer
371 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 ...
-3
votes
1answer
56 views

Perform DML over HTTP classes [closed]

How to insert, update... records by using the HTTP classes? I need to insert and delete records over an apex controller by using HTTP classes. I need to do it over HTTP because the DML has to be ...
2
votes
1answer
1k views

Patch Method http callout from apex [duplicate]

I must use this patch http callout. Is any one has idea? http://developers.goformz.com/docs/update-an-existing-data-source-1 I get error "Invalid HTTP method: PATCH" Exception. In our project ...