Questions tagged [httppost]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
22
votes
3answers
10k views

Session_ID_Remove Issue in API callouts in Salesforce

I have below code to get session id of another org and to connect it. Problem I am facing is not able to see session id . HttpRequest request = new HttpRequest(); request.setEndpoint('https://...
9
votes
2answers
950 views

ID query string parameter call to RestResource results in error

I'm looking to set up a RestResource endpoint that accepts some URL parameters and creates a lead record. Here's the basic gist of my code: @RestResource(urlMapping='/createLead/*') global with ...
3
votes
1answer
472 views

Multipart Post to Attachment

I am trying to send a binary file in Java to Salesforce '/sobject/Attachment' endpoint. Below is the code I am trying to use, but I keep receiving a 400 error. Any idea as to what the solution is? ...
2
votes
1answer
636 views

@IsTest - How to get the RestContext.response from @HttpPost if the post method is not returning [duplicate]

I created a @HttpPost API end point called SampleAPI that doesn't return an object. Instead I am populating RestResponse like so: @RestResource(urlMapping='/SampleAPI/*') global class SampleAPI{ ...
2
votes
1answer
449 views

Test Method for @HttpPost RestResource is not returning expected results

I have been looking all over the boards and found some useful posts regarding testing rest services, but even after spending the last 2 hours trying to implement many of those ideas, I still am stuck ...
2
votes
1answer
50 views

Why am I not able to parse valid XML straight from the Salesforce Documentation, but JSON works fine?

On this particular page: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_methods.htm About halfway down, you'll see a method which I have included in my class @...
2
votes
1answer
671 views

REST SERVICE - Unexpected parameter encountered during deserialization

its all perfect! why is this happening? the same endpoint and JSON works in workbench but not in my java code: REST API : @RestResource(urlMapping='/RestTest/*') global with sharing class ...
2
votes
1answer
89 views

Unable to process HTTP return codes except 200

We are having an integration with an external REST API which we are invoking from a SSJS script hosted on a cloudpage. We have tried couple of ways to invoke the API Call - Script.Util.HttpRequest &...
2
votes
1answer
153 views

HTTPPost2 send form data

How could I post data to a url with Content-Type: multipart/form-data I doing this, but it reports error to me: SET @httpPostCallStatus = HTTPPost2( "https://url-post-data", "multipart/form-...
2
votes
0answers
37 views

Sending an HTTP request with an imported WSDL with the string 'http://0X'

I have a WSDL that i consume imported as an Apex class. One of the methods receives one String param that is the account website, and one of our users inserted a website that starts with 'http://06'. ...
1
vote
2answers
83 views

How to expose REST API to external users — how do they authenticate and authorize to create lead in Salesforce [closed]

I am a bit confused. The requirement is that we need to create a REST API in Salesforce that has one POST method. Right now, I have been testing it with POSTMAN tool in 2 steps: Making a POST request ...
1
vote
1answer
689 views

Test for HttpPost service: how to take JSON body for test?

I have a HttpPost methods. And I really don't know how to test it correctly. My methods: public static App__c ParseRequest(RestRequest req) { App__c app = new App__c(); String body = req....
1
vote
1answer
4k views

A testclass for @RestResource @HttpPost

I have a @HttpPost method in @RestResource class: @RestResource(urlMapping='/Something/*') global with sharing class HttpClass { @HttpPost global static String updateCustomObject() { //Fetching ...
1
vote
1answer
132 views

HTTP GET method Error

I'm trying to retrieve my VisualForce Page that I have already Render as a PDF using my Apex Class so I can store the page as a PDF inside the document folder. But, I keep on having an Error when ...
1
vote
2answers
438 views

HTTPPOST request in Salesforce is failing when I run in JDK 7 but works fine in JDK 8

I am receiving a two different response for below HTTPPOST request based on the JDK version. On JDK 1.7 it says BAD Request, I am not able to understand the difference in those two responses. Could ...
1
vote
2answers
157 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":...
1
vote
1answer
349 views

HTTP POST Request with @future and schedulable

I need to create a schedulable Apex job which will send Sales Order Number from Case Object to my integration platform Web Service as JSON. This will be re-mapped and sent to another system, re-mapped ...
1
vote
2answers
865 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 ...
1
vote
1answer
110 views

@HttpPost test will not run - Method does not exist or incorrect signature: void doPost(String,

Just started with Apex last week so very new. Building a @RestResource to pick up webhooks sent from an external DB. Code has been tested and working as expected in Sandbox. Can not get the unit ...
1
vote
2answers
653 views

INVALID_SESSION_ID error when external app is calling GETmethod on salesforce

I have created webservice class with Get method. I have created Connected app and I have consumer key and consumer secret.But I don't have knowledge on how to use it. When external app is calling ...
1
vote
0answers
57 views

SSJS HTTP.Post ValidEmail with requested Access Token

I am trying to make an API request in SFMC to validate email addresses, which requires first to get the Access Token. I was able to request the access token, but then the next HTTP.Post request I do ...
1
vote
1answer
380 views

Visual Workflow plugin to callout to an external webservice and POST JSON

Can anyone help in providing an example of an APEX class which can make a HTTP JSON POST request to an external webservice using a plugin for SF visual workflow? Example I tried following here ...
1
vote
1answer
669 views

insert mutlitple records using restapi apex

I hv 2 salesforce instances & I am inserting multiple account records from source to orgnz. The access token part is working , but I do not understand how to pass multiple account records. In ...
0
votes
1answer
193 views

Trying to turn HTTP 'POST' to 'PUT'; Desire Upsert, Not Just Insert

I originally had the following trigger and REST-callout class that functioned properly: trigger SendOpp_Trigger on Opportunity (before insert, before update) { for(Opportunity o : Trigger.new){ ...
0
votes
2answers
33 views

Unable to retrieve security descriptor for this frame error in HTTP POST request SSJS marketing cloud

I am trying to post a request to my site and I am using SSJS HTTP post method. But the POST request is throwing error "" Unable to retrieve security descriptor for this frame. Im not sure what i ...
0
votes
1answer
72 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
1answer
45 views

Execute HttpRequest as a different user

We have a scenario that user invokes a callout via lightning component button. Its an http request to an external service, and on response - there is an update in SF. We would like that the running ...
0
votes
2answers
89 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
1answer
37 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 ...
0
votes
1answer
24 views

Can we use a map in HttpPost to make our code shorter? (too many fields and we can add more in future)

Can we use a map? And how to do that? Too many fields here already and we can add more in future. @HttpPost global static Ticket__c postT(String title, String whattime, String whatdate, String ...
0
votes
3answers
2k views

How to send Post request to Rest API with XML data

I have created a rest API(apex class) in Salesforce. I have multiple nested tags in xml that comes via API request. I am wondering how do I define my post method in apex that could handle the request. ...
0
votes
1answer
189 views

Apex Callout HTTP POST with Named Credentials error [closed]

I am constructing something wrong, in the POST request. Please advise. Step 1: Created Named Credential called Stock_Check_For_Materials Step 2: Created Apex Controller as below Continuation con = ...
0
votes
1answer
127 views

Callout REST HttpPost: how to create an object with all fields?

I wrote my Callout, but it create an object only with Id. How can I create an object with all fields? HttpPost: public static App__c ParseRequest(RestRequest req) { App__c app = new App__c(); ...
0
votes
1answer
409 views

Getting Error while try to get Salesforce OAuth access token from SFMC cloudpages ssjs httppost?

Actually I try to get access token of salesforce DC from salesforce MC by SSJS Httppost I need to create a record in salesforce object From Salesforce marketing cloud pages <!doctype html> &...
0
votes
1answer
54 views

How to create HTTP end-point which accepts POST data in Salesforce

I need to create a HTTP end-point for receiving transaction notifications from a payment gateway. How would I create a HTTP end-point which accepts POST requests with a variable set of parameters. ...
0
votes
1answer
701 views

Testing a REST Service POST method question

I am confused about some of the information in the developer Guide regarding setting up a REST Service POST method. I've set up my service similarly to the following example from the Developer Guide: ...
0
votes
1answer
381 views

Salesforce Rest API patch operation - Bad Request

I'm trying to invoke a PATCH operation on our organization's Salesforce API. The url is correct (format - https://xxxx.salesforce.com/services/data/v43.0/sobjects/Classification__c/objectid?...
0
votes
1answer
103 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 ...
0
votes
2answers
440 views

AMPscript HTTPPost2 function to make an SOAP API call

I'm trying to use HTTPPOST2 function to make an SOAP API call. Here is what my code looks like %%[ var @output,@respheader,@payload,@endpoint,@callstatus,@callresponse set @endpoint = '...
0
votes
1answer
31 views

HTTP Post response error - “Value was either too large or too small for an Int32.”

I am trying to retrieve a portion of the response related to a template-based email via a Cloudpage. I am attempting to get the "items" portion of the response. I get the following error: Value was ...
0
votes
0answers
54 views

Issue in retrieving response body for 4xx and 5xx response code via HTTPPOST2

I am calling third party API via HTTPPOST2 using ampscript, and need response body for response codes like 4xx or 5xx. For success scenario, I am getting the response body in response parameter of ...
0
votes
1answer
61 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?
0
votes
1answer
46 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
47 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
0answers
40 views

Test class For http Post

i wrote unit test code and got 52% code coverage and struck with following error: System.NullPointerException: Attempt to de-reference a null object. Please correct me where i wrong i am new tp ...
0
votes
1answer
77 views

How to execute class or method after update external id from post callout

I have a custom object in Salesforce with a set of fields. Some of the fields I sent over by an invocable method which calls a future method to send the first set of fields to entity in an external ...
0
votes
1answer
28 views

How to to foresee External ID in HttpPost?

When we post a Box record we also send it an External Id from another side. How to to make it in HttpPost method? I have an object1 in Org1. In Org1 are all my callouts. object1 has a button POST. ...
0
votes
1answer
25 views

Endpoint can not be null issue in scheduled batch callout job

I struggle with execution of HttpRequest POST in my Scheduled Batch job. I have written Test and Mock classes to test the callout itself (without Batch job) and it returns http code 200. My debug ...
0
votes
1answer
151 views

Apex Post not accepting setBody

public static HttpResponse getIntegratedInfoFromExternalService(String WebURL , String key) { Http h = new Http(); HttpRequest req = new HttpRequest(); req.setEndpoint(WebURL); ...
0
votes
1answer
544 views

Send Bulk SMS by calling Twilio API using http callout

I'm using Twilio to send SMS through salesforce. I'm able to send the sms by calling http callout to Twilio API. but, Now I've send bulk sms, when I inserting bulk record in salesforce. I'm ...