Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

The REST API provides a powerful, convenient, and simple Web services API for interacting with Force.com.

2
votes
1answer
21 views

How to connect to a third party REST API using OAuth?

I have a third party REST API that needs to be called from Salesforce, using OAuth for authentication. Is this actually possible? If so, how? I really can't find anything useful on the web. For me, it ...
2
votes
1answer
16 views

Composite Api Objects and Referencing RecordTypes

Is there anyway to reference an account recordtype by Name when creating an account using Composite API which has recordtypes? I am hoping there is a way so I don't need to do a get request to get a ...
1
vote
4answers
68 views

How to update a record in a trigger with value from a REST API?

When an account is saved I need to update it with value from a REST API. I though my approach would work but I'm getting the following compilation errors. Method does not exist or incorrect signature:...
0
votes
0answers
18 views

How to get an image from Salesforce link in RichTextArea in java?

How I can get a Base64 encoded image from salesforce link displayed in RichTextArea? I'm using GET request to this link but instead of image I'm getting a html page with some tags and links. I can see ...
0
votes
1answer
23 views

Error when using REST API to Add Rows to Data Extension

I'm trying to use the REST API to add data to a DE, but I am getting back a validation error when I make the call: Call: HOST: https://www.exacttargetapis.com/data/v1/async/dataextensions/key:...
0
votes
0answers
15 views

Calling salesforce Rest Api using Curl - Invalid Session?

I am trying to interact with the salesforce rest api using CURLS in Groovy. Right now, i have a curl retrieving access token, which looks like: def accessTokenCurl = 'curl -X post '+ salesforceUrl + ...
0
votes
3answers
23 views

Creating an endpoint in salesforce for our external service to access data

I started reading on REST API’s and have created this class to view order tracking information: @RestResource(urlMapping=‘/Tracking/*') global without sharing class TrackingRest_Service { @...
0
votes
0answers
13 views

How do I specify profile mappings on a PackageInstallRequest?

I have created an unmanaged package containing a Salesforce Platform Profile named "Foo". In the org where I am attempting to install the package, I have also created a Salesforce Platform Profile ...
0
votes
2answers
35 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
29 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
0answers
17 views

What is salesforce equivalent OPENSSL Code

What is the salesforce equivalent code for following script: printf "$signingString" | openssl dgst -sha256 -sign example_client_signing.key -passin "pass:changeit" | openssl base64 -A` I found that ...
-1
votes
1answer
25 views

Rest Resource URL mapping in workbench

i have written a rest web service class and mapped the resource as '/Accounts/*/contacts'. where * stands for Accountid. I am trying to do a POST call from workbench and having issue writing server ...
0
votes
1answer
9 views

how can aggregate the response returned by multiple calls in the list

I am making callout and getting the response. I am fetching the records in the batch of 200 so if there is 400 records there would be 2 callouts and getting data but the issue is second callout ...
0
votes
0answers
16 views

@HttpDelete: how to change SOQL filter from Id to the custom External_id?

We have an example from trailhead. But how can we change Id =: recordId to the External_id =: recordId in SOQL? I think we also change the logic of our code, because if just change it - Http-service ...
0
votes
0answers
34 views

Cannot specify Id in an insert call: [Id] in unit test for HttpPost

I have this error because I duplicate my object by method's calling. How can I fix it? My HttpPost: public static Avia__c ParseRequest(RestRequest req) { Avia__c a = new Avia__c(); String ...
1
vote
1answer
34 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....
0
votes
1answer
20 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
21 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
22 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
24 views

How to make Test Coverage 100%? HttpGet method

How can I test this for 100% coverage? @HttpGet global static List<Box__c> getBox(){ RestRequest req = RestContext.request; String boxId = req.params.get('Id'); if(boxId == null) ...
0
votes
0answers
9 views

How to get an E-Mail from a DataExtension - REST

I was trying to do a REST Call to check if a Customer exists in a data extension. I tried so maynway but I always get this response: {"page":0,"pageSize":0,"count":0,"links":{}, "...
0
votes
2answers
39 views

How to return null for list if we have too many records?

How to return an error msg, if boxes are more than 1000 and we can't return this list (return null + msg)? We need to do that with if or with try catch? Or we can try both variants? @HttpGet global ...
0
votes
2answers
40 views

DELETE a record by REST API without @HttpDelete

I need to make integration between Org1 and Org2. We created a callout POST. When we create an object in Org1, we also create an object in Org2. POST work. All is Ok. Now I need also delete an object ...
2
votes
1answer
26 views

POST a record from Org1 to Org2 with JSON and Map

I need to post created record from Org1 to Org2. I want to "put" my JSON into Map and just "open" Map in another Org. Needed result: fields from new Org1 Object's record = fields from new Org2 Object'...
0
votes
0answers
22 views

JSON_PARSER_ERROR in REST POST: Convert Picklist value from Org1 to String or Picklist value in Org2

All my values transferred good, but it's just Strings. When I try to post Picklist value into Text field I get this in debug msg: [{"message":"Unexpected parameter encountered during deserialization: ...
0
votes
1answer
41 views

System.NullPointerException: null argument for JSONGenerator.writeStringField() in POST Method

I have a custom Obj, and try to realize a POST method. But I get an Error: System.NullPointerException: null argument for JSONGenerator.writeStringField() What is wrong here? public static ...
0
votes
1answer
34 views

Apex Callout from one Org to another with method GET

Org 2 has GET Method: @RestResource(urlMapping='/jobShow/*') global with sharing class RestJob { @HttpGet global static List<Job__c> getJob(){ List<Job__c> jobList; ...
1
vote
0answers
26 views

How can I update a User Record from a custom AuthProviderPlugin's getUserInfo() method?

I am trying to integrate Salesforce with Jira using a Named Credential and oAuth 2.0. The Named Credential requires a Custom Auth. Provider which requires an AuthProviderPluginClass. The ...
1
vote
1answer
37 views

Deleting records in sales cloud using REST api

I am trying to delete multiple records using REST Api. var contentType = 'application/json; charset=utf-8'; var headerNames = ["Authorization"]; var headerValues = [("Bearer "+sessionId)];...
0
votes
3answers
39 views

DML vs REST API call to create a record

This question came to my mind out of curiosity. I have an apex class in which I want to create a record. I can use a simple insert DML operation to create it. Although I know that REST API services ...
2
votes
0answers
46 views

How do I access a Rest endpoint on a scratch org?

I've set up a connected app and a rest endpoint on a scratch org but can't access it through either the workbench, Postman or client code. I get the following error in each case: 404 Not Found ...
0
votes
1answer
80 views

Unexpected character ('a' (code 97)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]

I have a batch class which makes a call out to an api within the same org (the rest resource was developed by a 3rd party supplier and I cannot see its source code) Anyway, as per the supplier the ...
0
votes
0answers
16 views

Is there an object/table in salesforce that holds pagelayout assignments?

I am trying to get a list of which pagelayouts are in used withing the org. But I am not able to find the query/REST call to give me the list of Assignment of page layouts. In the Metadata object: '...
1
vote
1answer
76 views

errorCode“:”METHOD_NOT_ALLOWED“,”message“:”HTTP Method 'POST' not allowed. Allowed are HEAD,GET

I am running the below code in developer console to get OrgPercentage coverage, but it is throwing an error "errorCode":"METHOD_NOT_ALLOWED","message":"HTTP Method 'POST' not allowed. Allowed are ...
0
votes
2answers
52 views

Endpoint for getting GlobalValueSet using REST API

I'm trying to use the REST API to get the list of values for a Global Value Set. Since it is not a field on a specific SObject, I don't think you can query for the values. I am successfully ...
1
vote
0answers
70 views

sObject Collections - Update Multiple Records via REST using PATCH - Bad Request 400

I am trying to use the Salesforce sObject Collections REST API resource that was released in Spring '18. Per the Salesforce Documentation, this should be a PATCH request, however when I try to call ...
0
votes
0answers
56 views

Displaying REST response on the VF page on button click

Overview: I am making call to Pardto to fetch prospects and display them into Salesforce VF page on button click. I am getting response fine from pardot but it is not displaying on the vf page. Not ...
0
votes
1answer
14 views

How to store rest response data into Salesforce custom object as records

I have created REST service which is fetching prospect data from pardot and now I want to store it into Salesforce's custom object. I have some fields inthis object which I need to map from the ...
2
votes
0answers
27 views

Unsubscribe MobilePush Contacts with Automation

I need to unsubscribe multiple Contacts from Push Messages with the help of external attributes. It is to be done within an Automation. The only way I see I can do this is the following: Get ...
0
votes
0answers
42 views

AMQP protocol from Apex - RabbitMQ

I am trying to connect and send data to RAbbit MQ messaging protocol. At all places it is provided that we should use AMQP protocol and this is something I am not sure how to do from Apex. Has anyone ...
1
vote
0answers
25 views

Cannot insert Contact with REST API if a Lead with the same e-mail address exists

I noticed in the UI that when I try to insert a contact with an e-mail address that a lead already has, I get a warning (before I click save and insert the contact) saying that this is a possible ...
1
vote
0answers
17 views

Retrieving all calls, posts, comments etc for a Case

We have the following scenario in an application built with React and implementing the REST Api via an integration user. We currently: Retrieve a list of cases based on a custom Master ID field ...
0
votes
1answer
90 views

Create leads in Salesforce through REST API. How to assign assignmentruleHeader and emailHeader?

I am trying to add leads in salesforce through rest API.Code is in java. I have converted WSDL to jar files and added as reference in Eclipse which allow to access salesforce objects in java. PFB my ...
0
votes
2answers
25 views

Unable to convert phone to string in apex

I am working on rest API services. I need to push phone number as a string in the body of the request. I tried following way. String Str1=ts.phone.replaceAll('(',''); String Str2=Str1.replaceAll(')',...
0
votes
1answer
82 views

Post request returns error 405 on ngrok

I'm using ngrok in order to tunnel localhost and check my REST request from Salesforce. However, when I send POST request I get error 405 - method not allowed. Below there is my code: HttpRequest ...
0
votes
1answer
161 views

Invalid conversion from runtime type String to Map<String,ANY> not working

I have a requirement to call a external service with post method. When i tested in anymonous block.It's working fine. But when i try to set up test classes i got this error. in line Map results ...
0
votes
0answers
17 views

how we can upsert metadata in salesforce using REST api?

how we can upsert metadata in salesforce using REST api? i am able to retrieve but not upsert so any body help me?
2
votes
1answer
21 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 @...
0
votes
2answers
63 views

Marketing Cloud sending Content Builder Email to List

I have created a list (using SOAP API) and know the ID of this. The HTML Email exists in Content Builder, I know the name and the ID. How can I send the email to the list. This is not a triggered ...
0
votes
1answer
183 views

Status Returned 200 but response body is blank

I'm new to integration. I am going to generate an access token for the third-party application. I tried to build following javascript request in sfdc. But the response body is blank. I need to ...