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
0answers
28 views

Apex batch job failing with “First error: Read timed out”

I have a batch job that is failing with the following error First error: Read timed out In the debug log, I got the repsonse as FATAL_ERROR|System.CalloutException: Read timed out When I ...
0
votes
0answers
24 views

Not Found / Forbidden error while using GET Operation in AWS S3 folder

I'm trying to get a csv file from a AWS s3 bucket, I've access to bucket and some of the folders in it. But i'm unable to access("GET") files from one of the folder. I get an error NOT FOUND"/404 when ...
-2
votes
0answers
9 views

Client's Compliance Won't Allow I-Frame from MC… APEX Question [closed]

https://trailhead.salesforce.com/en/content/learn/modules/apex_integration_services/apex_integration_webservices Has anyone integrated a form using the Apex as per this link above?
0
votes
1answer
24 views

How to query only field-history-enabled objects in apex?

We have 5 objects. In these objects, we are only tracking 3 objects’ field history, How can I query on objects with history enabled? I want to get only field history enabled object Names. Please ...
1
vote
2answers
62 views

Logging Solution for Force.com Public RESTful webservice

I've created a public site with a RESTful service mentioned in this blog, however this site uses Guest User License and I can't see any debug statements when this webservice is used by Postman. Is ...
2
votes
1answer
66 views

Named Credential Authentication [duplicate]

I am trying to connect with Xero using Named Credentials. I am using oAuth2.0 authentication protocol. I have created a Auth. Provider and Named credentials as shown in the image below The Named ...
2
votes
1answer
59 views

What is best Option to store Access Token, Refresh tokens?

Platform cache : I am using platform cache but platform cache is not returning anything after very small period of time ( approx 30 sec- 60 sec ). Custom Setting : Custom setting has a limitation of ...
0
votes
1answer
112 views

Salesforce to Xero Integration Using oAuth2.0

I am trying to setup a connection between Xero and Salesforce using oAUth2.0. I am doing it as per the Xero Documentation mentioned here: https://developer.xero.com/documentation/oauth2/auth-flow ...
2
votes
1answer
27 views

ApexREST Websrvice StatusCode with ResponseBody

I am writing a REST Webservice and have the following piece of Code. @RestResource(urlMapping='/UpdateTransaction') global with sharing class OpportunityTransaction { @HttpPost global static ...
0
votes
3answers
54 views

Error Handling in REST Webservice

I have exposed this Apex class as a webservice. So far so good, as I get the response when this Webservice is called from ARC or POstman. @RestResource(urlMapping='/ProcessAccount/*') global with ...
2
votes
1answer
24 views

Bypassing Header Based Authentication

I am configuring a REST Hook between Salesforce and this marketing tool AutopilotHQ. Rather than having Salesforce continuously poll to find out when there is new information to trigger from, ...
0
votes
2answers
37 views

Apply pagination in Rest Resource

I have rest resource exposed to a external system. It is a simple rest api where i get a single parameter from the URL and query a custom object based on that param and return the results in a custom ...
0
votes
1answer
33 views

Composite REST Resource Not Found

I created a composite REST to insert opportunity for existing account, but all the GET method return error resource not found.. someone help { "allOrNone" : true, "compositeRequest" : [{ "method" ...
0
votes
1answer
39 views

JSON Formatting error

I have a requirement wherein I have to strictly format the body of the request as below. { "body": "* Case Number: 1406800\n* Primary Contact Name: Larry Brown Portal \n* Test:SampleTest" } ...
0
votes
1answer
25 views

Not able to view attachment in salesforce, when uploaded through Multipart Rest API

Below is the code which I'm trying to insert attachment through API not sure what is wrong, when I try to open 'Failed to load pdf' error comes or if I send image type file then that also doesn't open ...
1
vote
0answers
30 views

HELP API Callout error uncommitted work pending for bulk update

I created a batch class that calling an API and then update the records. This batch running every 5 minutes. And there`s a custom button, if I click that custom button, the batch will run only for ...
0
votes
1answer
51 views

How to send authorization to web app using Rest API [closed]

This is my first time working with API and I'm trying to understand how to send authentication to an web app using REST API. Questions I have: Do I need to setup Oauth in Salesforce in order to ...
0
votes
0answers
14 views

Set header and add header in rest Class

I have below class which i need to test it from workbench/postman. I am not sure how should i test it . @RestResource(urlMapping='/CheckAuth/*') global with sharing class example1 { @HttpPost ...
0
votes
0answers
28 views

How to access the REST API with the user with Permission 'Is Single Sign-On Enabled' is enabled

I have created one RestResourc to give the ability to the external system to attach the Report to Asset in Salesforce. Now the problem I am facing is the user which I am using for Authentication ...
0
votes
2answers
55 views

Salesforce Rest API, Issue in getting Params from Rest API

In the below code, If I print the String variable report, I am able to get only half of the string that is 123 characters, while the external person is actually passing me a string that contains ...
0
votes
0answers
53 views

Apex callout yields “Ending position out of bounds: -1” error

This is my vf page <apex:page controller="AccountRest"> <apex:sectionHeader title="Accounts" subtitle="List View"/> <apex:pageBlock> <apex:pageBlockTable value=...
0
votes
1answer
38 views

REST Endpoint Returns NULL in Test Class

I have a RestResource mapped to /Demo/ that I place on a Salesforce Site. The rest resource works great, including the parameters. However, in my test class I cannot get it to return anything to ...
1
vote
1answer
45 views

PDF file is getting corrupted when sending by HTTP callout to external system

on file upload below function is called in LWC. LWC Function uploadHelper() { this.file = this.filesUploaded[0]; this.fileReader = new FileReader(); this.fileReader.onloadend = (() =&...
1
vote
2answers
39 views

Query All Knowledge__kav records

I am stuck with weird situation. When I execute the following query SELECT Id, ... FROM Knowledge__kav Nothing is returned (0 records result) But when I execute the following query SELECT Id, ... ...
1
vote
2answers
69 views

HttpResponse[Status=BAD_REQUEST, StatusCode=400]

I'm trying to sending a field value to third part but here the issue is Suppose the filed is Name = "Test Account" here in this case call will be failed but for suppose Field Name is like Name = ...
0
votes
1answer
41 views

Auto Refresh Access Token

I have written this method to get accesstoken when I send Id & password given(Which I havent Hardcoded Below). I am saving my access token in custom setting and want it to expire, call this method ...
0
votes
0answers
85 views

Has anyone solved the error 415 (Unsupported Media Type) in salesforce?

Has anyone solved the error 415 (Unsupported Media Type) in salesforce ? I tried to upload a file to ContentVersion via rest api request but it 415 error will be returned by my org. Is there any ...
0
votes
0answers
37 views

Issue converting file object types to String format from an incoming OneDrive REST API call

I'm trying to pull a file object-type from O365 via the Graph API and I'm getting back a return-type that is pretty atypical to the normal JSON return format I'd expect to see. I'm not sure if it's ...
1
vote
1answer
112 views

Get the Info of a REST API Sender

Is there a way to get the Sender info in a Rest WebService? for example : Part A - Sender sends this JSON Via POST Request : Http httpProtocol = new Http(); HttpRequest request = new HttpRequest();...
0
votes
1answer
54 views

How do you create an endpoint in salesforce that accepts files (csv)?

I would like to create an apex service in salesforce that accepts csv files. Resolved this issue with the following: Created a public site which the FileUpload class is added. Since I need to create ...
0
votes
1answer
28 views

Simplifying REST API calls

I'm new to Java programming and I'm trying to reduce the number of REST API calls I make in my program to better organize it and I'm not sure how best to approach it if the simplest way is to have a ...
1
vote
0answers
27 views

Help writing Salefsorce Api call Test class

I have used some of the guides available like (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_httpcalloutmock.htm), but still having trouble ...
0
votes
0answers
21 views

QueryMore (or similar functionality) for custom rest api

We are trying to implement a custom rest api for a custom object which has more than 2000 records. We are doing pagination based on CreatedDate of the records and display 200 records each page. We ...
1
vote
1answer
44 views

Using curl to retrieve data from Apex: Where to get security token?

curl -v https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=<your_consumer_key>" -d "client_secret=<your_consumer_secret>" -d "username=<...
2
votes
1answer
190 views

Apex REST API - Unable to set StatusCode to 429

I am trying to set the status code to 429 for Too many request using the code below: if(Limits.getQueries() < Limits.getLimitQueries()){ upsert UpdateData; } ...
1
vote
1answer
41 views

Malformed JSON: Expected '{' at the beginning of object for the LIST

I am making an endpoint call and trying to extract the value from JSON.I am getting the parser error. What I am doing wrong here? Apex controller HttpRequest req = new HttpRequest(); req....
1
vote
1answer
377 views

Apex Rest - Api error handling HTTP status codes

I am trying to handle multiple error codes in my REST service. Can anyone guide me if I am doing this correctly. try { if(Limits.getDmlRows() < Limits.getLimitDmlRows()){ ...
0
votes
1answer
164 views

STATUS_CODE returned for the response: 403 STATUS_MESSAGE returned for the response: Forbidden

Can someone please guide me how to resolve the access forbidden 403 status code error ? What can i do to at least hit the end point? I am executing the code anonymously in developer console string ...
1
vote
1answer
27 views

Usage of Connected App in terms of exposing a RestResource API for consumption?

I know I have done it before, but I am lost this time around. Previously, I have created Connected Apps for implementation of Oauth 2.0 authentication process with Salesforce. But, this environment is ...
1
vote
1answer
57 views

How can I disable my existing Apex REST Webservice in production?

I have an existing Apex REST Webservice configured in production for consumption by a partner for Lead creation. However, we are not working with that partner anymore and hence want to disable this ...
0
votes
1answer
144 views

Apex call-out 404 not found error on Developer console while it works perfectly when the request is sent through postman

This is the request, I've added the URL to named credentials. What am I doing wrong!! Http http = new Http(); HttpRequest request = new HttpRequest(); request.setEndpoint('Callout:AppointmentTest/...
1
vote
1answer
266 views

First REST API Call for the day taking more than 40 seconds

We have exposed a custom rest webservice to perform dml operation on Case. We have a custom metadata where we fetch for a particular record based on the request parameter and populate the values for ...
0
votes
1answer
41 views

Rest Resources calling problem [closed]

I need to help about rest resources. We want to set a job that will come to salesforce and take data that we give by rest resources. However, the problem is that how to call apex rest service from ...
0
votes
1answer
276 views

How to append XML root element to an existing xml string

I have XML string like below in that I have to add root element and some attribute using apex. I was searching this for whole day but I din't get any key point. I saw there is some support for DOM and ...
0
votes
0answers
51 views

Salesforce Apex Error

Sync down of settings is failing in salesforce mobile native swift app.The error from salesforce is NSLocalizedFailureReason = APEX_ERROR Sync type:syncDown id:1 FAILED cause:Server call for sync ...
0
votes
0answers
120 views

Rest request for file upload in chunk around 8MB

I want to pass the list from helper class to apex class method but unable to pass. can anybody help over this. Below are the code of component and helper class declared in component class <...
0
votes
0answers
17 views

Salesforce REST API Call to an External API (IdentityServer3) Login Error

I have a project where I need to connect to an API to get data. I tested the API in postman and I'am able to get data, but when I try to connect from Salesforce I having a problem in authentication. ...
1
vote
0answers
32 views

Record Lock Issue for REST endpoint

I have built a REST endpoint, which writes data(Accounts) to Salesforce. Currently, for a single record, there could be multiple (20-30 times) upserts within 1-to-5 seconds. Behind the scenes, it's a ...
0
votes
1answer
34 views

WB REST API POST

I need connect an application with salesforce. This aplication will send data to the system, and salesforce work with them. In this case, in the third application, user choose products. When user ...
0
votes
1answer
185 views

Generate JWToken from salesforce using Consumer Secret

I am trying to connect to an API and based on their requirement, JWToken is required to make a call and the JWToken must be signed using the provided consumer secret. Now, they have a sample code in ...