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
33 views

Connected app OAuth2 and Named credentials used in salesforce rest callout to create/access record in same org only. But receiving 302 status?

We are trying to create product schedule using rest api and for Oauth2 Authentication ConnectedApp, Auth Provider, Named Credential. When we made callout using named cred it is showing 302 status and ...
Gaurav Patil's user avatar
-1 votes
0 answers
35 views

Callout to an External system every one hour [closed]

I have a requirement where salesforce needs to make a callout and get more than 10,000 records from an external system. Ex: first callout at 10 AM --> get 12,000 records, 11 AM --> get only ...
joshallen's user avatar
1 vote
1 answer
129 views

Setting Up Named Credentials For Connecting Two Salesforce Instances i.e. Sandboxes

Hope everyone is well. I was wondering if someone could provide some guidance on how to setup Named Credentials to connect two sandboxes together for using REST OAuth to post data from Sandbox A ---&...
Nelson Chisoko's user avatar
0 votes
0 answers
101 views

I am receiving Response Status Code: 500 {"status":"error", "message":"List has no rows for assignment to SObject"} for the below code

Calling a REST API apex class from apex trigger and seeing below errors. Response: System.HttpResponse[Status=Internal Server Error, StatusCode=500] Response Body: {"status":"error&...
Dileep Katari's user avatar
0 votes
0 answers
32 views

Not able to hit restresource URL from LWR community site

Issue: From my LWR community I am not getting the output from the restresource URL I created one rest resource like as below code. PS: I commented all my original logic and just trying with some test ...
SFDC-Beginner's user avatar
0 votes
0 answers
23 views

Creating Named Credentials via Connect API

I'm testing creating named credentials via connect api. Is this the right way of doing it? Source: https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/...
humanoid's user avatar
  • 327
1 vote
0 answers
589 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,209
0 votes
0 answers
114 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 ...
SFDC Beginner's user avatar
0 votes
1 answer
103 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
200 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
217 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
83 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.8k
0 votes
0 answers
30 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
307 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
334 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
92 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
95 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 ...
bnthsrikanth's user avatar
1 vote
1 answer
863 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
55 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
68 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
526 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
443 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
160 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
-2 votes
1 answer
159 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
-4 votes
1 answer
445 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
348 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
1 vote
0 answers
1k 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
25 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
368 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
  • 373
1 vote
1 answer
285 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
888 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
  • 987
2 votes
1 answer
748 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
  • 595
0 votes
1 answer
93 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
331 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
619 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
  • 566
1 vote
3 answers
358 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
656 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,435
0 votes
1 answer
261 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
268 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
312 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
  • 505
0 votes
1 answer
146 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
233 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
456 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
271 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
264 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,209
0 votes
2 answers
746 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
80 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,257
0 votes
1 answer
399 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
602 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

1
2 3 4 5
13