Questions tagged [httppost]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
22
votes
3answers
13k 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
1k 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 ...
5
votes
1answer
171 views

Can we Have two Http Mock Callouts in a single test class method

In My Method making two callouts in a single transaction Get Access Token For that API --> GetAccessToken Execute Payment When i ran the test class getting following error 08:50:00:839 ...
3
votes
1answer
600 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
971 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
890 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
87 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
2answers
2k 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 ...
2
votes
1answer
870 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
267 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
248 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
53 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
1answer
6k 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
2answers
219 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
2k 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
817 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
1answer
162 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
496 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
320 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
2answers
1k 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
203 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
1answer
150 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
608 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
819 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
367 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
153 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
496 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
626 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
103 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
116 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
38 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
27 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
1answer
458 views

SSJS HTTP.Post throws error instead of returning status code

I am banging my head against the HTTP.Post function. The documentation says: Performs an HTTP POST using the provided information against the passed URL. The function returns a JSON object ...
0
votes
1answer
81 views

How Do I Send an HTTP POST API Call Through a Script Activity Using Basic Auth?

I have seen a few posts about how this can be done using oauth, but I need to use basic auth and I can't seem to get it to work. Below is an example of the code I'm using. <script type="javascript"...
0
votes
3answers
8k 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
447 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
2answers
749 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
86 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
862 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
41 views

Not able to Save the HTTPPOST2 response in the data extension

I have made a HTTPPOST2 API call and got the JSON response. I want to insert the JJSON response into Data Extension. Below is the JSON response : { "success": true, "...
0
votes
1answer
99 views

Apex rest service issue with HTTP Post method when i Access from Postman

i created Apex rest service and @HttpPost method , i am able call POST method & got data in request body successfully from workbench. but i had issue with when i try to access from Post man. i ...
0
votes
1answer
35 views

salesforce Apex class - Http Post json

This is kind of new to me - I need to make apex http post call and to set the body as json. My json is constructed in the following way: { "request": "request", "ID": "reqId", "getString": { ...
0
votes
1answer
477 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
129 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
577 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
0answers
42 views

SSJS Error on HTTP.Post

I'm facing an issue on sending an HTTP post request from Marketing cloud to ElasticSearch using SSJS. The aim is to send some import statistics of flat files to ElasticSearch in order to retrieve it ...
0
votes
0answers
30 views

Writing a test class for an HttpPost [duplicate]

I'm not able to figure out how to get any code coverage on an Apex HttpPost method. Apex class: @RestResource(urlMapping='/approve/*') global with sharing class exAppClass { jstcl__TG_Timesheet__c ts =...
0
votes
1answer
35 views

http callout `Client credentials are missing` by using Basic Auth

I am trying to get the access token by calling PayPal API,I Am getting Client credentials are missing response. public static HttpResponse GetAccessToken() { Http http = new Http(); ...
0
votes
1answer
83 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
1answer
463 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?