Skip to main content

Questions tagged [apexrest]

Apex REST enhances the Force.com REST API to allow developers to create custom REST-enabled web services using Apex.

Filter by
Sorted by
Tagged with
0 votes
0 answers
118 views

System.CalloutException: The callout couldn't access the endpoint

I have created an Apex REST endpoint and I want to test it using an integration user that I've also just set up. The integration user is using the "Salesforce Integration" User License. I've ...
Mike's user avatar
  • 1,199
0 votes
0 answers
61 views

REST API call - cvent 401 error Code

I'm trying to write a CVENT REST API call in my code. According to the documentation, I'm sending all the required parameters. The same request works perfectly in Postman, but in my code, it returns a ...
SK2889's user avatar
  • 921
0 votes
1 answer
52 views

How to decrypt an encrypted incoming webhook payload

I have set up a webhook in an external system to send data to my salesforce sandbox. My sandbox is getting the webhook payload but its encrypted. This is my Apex Class @RestResource(urlMapping='/...
sfNewbie's user avatar
1 vote
1 answer
83 views

How to Avoid Heap Size Error on response body

Daily orders loads records but some records are missing to load to fix this we have created another batch apex to call each day records and we are comparing with already exists benefitdisbursement ...
Afrose ahamed's user avatar
0 votes
1 answer
90 views

"message": "JSON request body must be an object at [line:1, column:2]","errorCode": "JSON_PARSER_ERROR"

I attempted to send an HTTP request and transmit a JSON to the Salesforce REST API in the following manner, but encountered the following error: Error: [ { "message": "JSON request body ...
yukichia's user avatar
0 votes
0 answers
61 views

Exposing existing methods via the REST API

Given a class with a large number of methods (200+) because it acts as a fascade for the putrposes of Visualforce remoting, how would these same methods be best exposed to the REST API? I'm thinking ...
Matt Lacey's user avatar
  • 25.7k
0 votes
0 answers
24 views

Getting Invalid field ReplyToken__c for SObject Case: Markup while using tooling api to create an apexpage

here is the curl and response I am getting while trying to create an apex page curl --location 'MY_DOMAIN/services/data/v54.0/tooling/sobjects/ApexPage' --header 'Content-Type: application/json' --...
Karan Khadka's user avatar
0 votes
0 answers
161 views

Apex Rest API POST multipart/form-data get no file parts in upload

I used Apex REST API to send data to OCI to update availability, but receive 400-Bad Request with response data: { "errorCode" : "Unknown", "message" : "No file ...
VHTT's user avatar
  • 1
2 votes
1 answer
230 views

Validating Hubspot webhook request signature in Apex

I'm new here and I'm hoping to get some guidance on the proper way to write this in Apex. I have a webhook coming from Hubspot and I'm receiving it successfully in Salesforce using an apex class ...
Sharina Grace's user avatar
0 votes
0 answers
54 views

How to preserve rich text formatting in contentNote after escaping HTML characters to prevent XSS attack

I need to insert contentNote record from apex rest api. Below is the sample code ContentNote noteRecord = new ContentNote(); noteRecord.Title = 'Title'; String body = restJSONdata.get(...
Monalisa Das's user avatar
0 votes
1 answer
65 views

Turning off lead assignment rules in triggers not working?

I've a rest resource in apex which upserts leads based on the lead phone number but the problem is when lead owner is changed manually from UI and again it is updated from apex rest resource the ...
mine_username's user avatar
1 vote
1 answer
788 views

Enforce RFC 7230 Validation for Apex RestResponse Headers - Need to understand

I am analysing the impact of the salesforce release update "Enforce RFC 7230 Validation for Apex RestResponse Headers". In our org's apex class logic, we have @RestResource(urlMapping='/...
Sindhuja's user avatar
  • 155
0 votes
0 answers
45 views

How to call salesforce service end point as current user while using Named credentials as LWC is the invoker based on user action

What is the best way to call salesforce service end point as current user. As Named credential authenticates as one specific user who initially authorizes it. I am calling my apex helper method from ...
Naren's user avatar
  • 19
0 votes
1 answer
55 views

We have a very complex JSON payload which we need to parse and create records Facing issues to fetch inner elements while parsing the data

The code below is for fetching values from the request payload. However we are stuck where there is an inner element of type array called "doc" present under "smt". From this array ...
Aritra Dasgupta's user avatar
1 vote
1 answer
267 views

Cannot deserialize instance of textarea from VALUE_STRING value

Iam transferring data through integration I am using Standard REST API https://instancename/services/data/v49.0/sobjects/Objectname/ In JSON payload we are sending text area fields along with other ...
Dilip Reddy's user avatar
0 votes
1 answer
272 views

Unable to fetch accountId of User in Test class

I am stuck in scenario while writing logic for my Test class. I am not able to access Contact.AccountId of User created in test case. I have created a TestUtility class for creating the community user....
user15754268's user avatar
0 votes
1 answer
30 views

Account deletion job based on object relations

I have a requirement for creating a job for deleting the accounts that do not have related cases, opportunity, Lead. The 3 objects can also change in future and new object to be checked can be added ...
user15754268's user avatar
-1 votes
1 answer
102 views

"Required" attribute on a property of a Class in APEX?

I have a request class used to call into a REST endpoint for an APEX class. I wish to mark a property on the class required so that I do not need to manually validate the field. How is that done? ...
Ian Vink's user avatar
  • 109
0 votes
0 answers
67 views

Missing required 'subjectId' parameter for Sending a Direct Message Connect REST API

Send a Direct Message URL above is giving me the endpoint and body for sending a direct message in community. When run in workbench, the DirectMessage, DirectMessageFeed, and FeedItem record was ...
JMRAF's user avatar
  • 31
-2 votes
1 answer
122 views

To have different data type for same variable in Rest API Request body

I am trying to wrap a request body from callin request which has a variable but values can be different data types. Example request body 1 : { RecordId:"cncjdn" } Example request body 2 : { ...
sf developer's user avatar
0 votes
0 answers
48 views

Salesforce OAuth Token endpoint certificate not accepted

We're currently working with Bank of America to provide an exposed Rest Service that they can use to send in financial data. We are currently running into a roadblock, in that they aren't able to ...
Alexander Folkerts's user avatar
-4 votes
1 answer
289 views

I'm sending a JSON Body from Postman to hit Apex, but I'm getting a deserializing error

I'm using below payload from postman and trying to hit an Apex class. { "First_Name__c": "elon", "Last_Name__c": "musk", "Email__c": "...
malik ambar's user avatar
0 votes
0 answers
265 views

Impossible to get the Grouping columns (count) if the RowCount button from the UI in Salesforce report is Unchecked

I am hitting this rest API end point in Apex in order to get Salesforce Report Data. String dash_url = '/services/data/v35.0/analytics/reports/'+repId+'?includeDetails=true'; It fetches me result and ...
Rakshit Segwal's user avatar
0 votes
0 answers
238 views

Connecting AWS API Endpoint to Salesforce to Apex REST

My company tasked me to look into end-to-end event flow between AWS and Salesforce using the newly released Event Relay. I successfully followed the guide, sent CDC events from Salesforce to AWS, and ...
Art S's user avatar
  • 311
1 vote
0 answers
853 views

How to pass JSON data in the REST API URL without misinterpreting double quotes?

Hello Salesforce community, I'm currently working on integrating with a REST API and facing an issue with passing JSON data in the URL. Whenever I try to include JSON data, specifically the provided ...
Avin Babu Pattathy's user avatar
0 votes
0 answers
24 views

Unable to get full code coverage for a SF trigger after update [duplicate]

I have a simple Apex trigger, written for an object called Application__c, and it fires after the "Shipping_City__c" field changes: 1.trigger MyTrigger on Application__c (after update) { ...
Rose Mirzaei's user avatar
1 vote
2 answers
265 views

Invalid type when assigning values to wrapper

I have a nested wrapper class but I am failing to understand how to assign values to the variables of the nested class. public class Req_Wrapper { public Envelope Envelope {get;set;} public ...
Akash's user avatar
  • 363
1 vote
1 answer
241 views

Most Appropriate HTTP Method for Query with Optional Upsert?

I have inherited a REST endpoint that has one key action it performs, named find. This action will generally just query for any matching resources, rank them, and return the most favorable result. ...
Adrian Larson's user avatar
  • 151k
2 votes
1 answer
724 views

401 Unauthorized Error on calling REST API from an Invokable Method called by flow

I have a flow and this flow calls an invokable method (where callout = true) that calls the Org REST API to update a Slack ViewDefinition. The method works perfectly when called from an Anonymous ...
Saulo's user avatar
  • 967
2 votes
1 answer
637 views

Retrieve Blob Value from Composite API

I was able to retrieve the response from the Blob Retrieve endpoint /services/data/v55.0/sobjects/Attachment/OOPXXXXXXXXXXXXXXX/Body but when i use composite request endpoint: /services/data/v55.0/...
Rival's user avatar
  • 593
0 votes
1 answer
86 views

How can I add the RestContext.response in the batch class finish method?

I am creating a REST class wherein all the processing is done by a batch class. I would want the RestContext.response line to be made after the execute method. But it returns this error: "System....
Mae's user avatar
  • 339
0 votes
0 answers
281 views

AWS S3 delete multiple files: signature does not match the signature you provided

I'm trying to use an apex class to remove multiple files from any specified S3 bucket, but at the moment of sending the request, I recieve the following response: SignatureDoesNotMatch The request ...
César Villanueva's user avatar
0 votes
2 answers
500 views

How to bypass Apex DML transaction limit of 10k records? (cannot use Batch)

I am trying to implement a solution that will allow users to create 10k+ records via UI. Basically, there is a custom component that allows multiple record creation. There could be 20-50k records, so ...
m_konyk's user avatar
  • 546
1 vote
3 answers
334 views

Synchronize Data between External System and ISV app

My AppExchange Managed Package and its related External System share a central data object. Records of those objects can be created, modified, and deleted both in Salesforce and the External System. I ...
Robert Sösemann's user avatar
-1 votes
2 answers
523 views

Use a date field on a Rest Query In Apex

I am trying to make a rest callout from one Salesforce org to another and I am using the following query in the rest end point DateTime sdt = DateTime.newInstance(startDate.year(), startDate.month(...
Madhurima's user avatar
  • 1,425
0 votes
1 answer
236 views

Nested Json not detected

I'm trying to parse a nested JSON through a REST Api but somehow it is not getting read. For example: I'm passing a JSON like this in my request body. [ { "first":"I like sfdc", &...
Accredo2442's user avatar
0 votes
1 answer
251 views

Issues with SOAP API login callout

I have the following piece of code that used to work before: Custom_Data__c cData = [SELECT Password__c, Security_Token__c, Username__c FROM Custom_Data__c WHERE Name = :Constants....
Alin Paraschiv's user avatar
-1 votes
1 answer
275 views

How to parse a json having Rows and Columns

I have the below JSON and want to parse it out to get the data. But the JSON format is in Rows and Columns. { "returnValue":{ "columnNames":[ "RowID", ...
V T's user avatar
  • 507
0 votes
1 answer
124 views

How to establish Unique reference between parent child in apex rest insert

I have a requirement to insert a 2 level nested JSON structure in Apex. I have 2 objects created, say, objA__c and objB__c. objB__C has Master Detail relationship to objA__c. objA and objB items can ...
UserSF_321's user avatar
0 votes
1 answer
220 views

wrapper class does not match with json resulted from POST request

I have this apex class (coded by another developer) @RestResource(urlMapping = '/thunder/contapj/*') global class Thunder_SVC_ContaPJ { public static Log_de_Integracao__c log = new ...
Juliana Marcelino Batista's user avatar
0 votes
0 answers
404 views

JSON Exception for Restful Apex Service in test class

Creating a Salesforce REST Api to create a contact when json is posted to it from workbench and my code functions correctly but my test class gives me a weird error that I am not sure how to fix. The ...
Reed Badman's user avatar
1 vote
0 answers
264 views

Deploy Metadata with Apex Testing Using REST : No package.xml found

I have explored below two options to deploy metadata into my salesforce account. Option 1: Bundle zip file is available here: bundle zip I am able to upload the bundle zip using workbench Workbench ...
SathiVenkata KrishnaReddy's user avatar
1 vote
1 answer
224 views

HttpPut methods do not support parameter type of [user defined type]

I'm at a loss. This class already compiled, was deployed, and has been working fine in production for over a year. Upon updating it, I'm now getting: HttpPut methods do not support parameter type of ...
Mike's user avatar
  • 1,199
0 votes
2 answers
670 views

Custom fields not being saved

I'm using propertybase to create contacts via salesforce (it uses apexrest REST API) and I followed this guide: https://help.propertybase.com/hc/en-us/articles/360003180752-WebToProspect-REST-API I'm ...
Gabriel Costa's user avatar
0 votes
1 answer
78 views

Can't get hello world unit test for Apex REST working

I'm in a scratch org and created SalesRepAPI.apxc as follows: @RestResource(urlMapping='/get_sales_rep/*') global with sharing class SalesRepAPI { @HttpGet global static Id getSalesRep() { ...
k..'s user avatar
  • 1,217
0 votes
1 answer
383 views

How to Write a Trigger when you insert or update a Contact, its Parent account's description should be populated into the contact description?

I need to write a trigger for the following operation: when you insert or update a contact, its parent account's description should be populated into the contact description. I am unable to do this.
Amax1's user avatar
  • 121
3 votes
1 answer
535 views

Expose public Webhook listener from Managed Package

Many external Services allow you to register publically reachable URLs that will be called with or without a Payload as an event mechanism between systems. I want my Managed Package to exactly have (= ...
Robert Sösemann's user avatar
0 votes
0 answers
94 views

Can we add global method or rest endpoint in locked package patch version?

We can't add new components to the package while creating the patch version of locked package. We have a requirement, where we need to add the global method or rest endpoint. Is it possible through ...
Hemant Keni's user avatar
0 votes
1 answer
507 views

Record triggered flow after save get child records

My scenario I have an apex class that extends RestResource.Base In this class I insert both the parent and child record at the same time List<SObject> recordsToInsert = new List<SObject>();...
Elephant.jpg's user avatar
1 vote
1 answer
322 views

Can't parse JSON properly - access to inner list values

for two days, i am trying to figure out parsing of following json. [ { "name": "Czech Republic", "alpha2Code": "CZ", "...
MatejN's user avatar
  • 31

1
2 3 4 5
13