Stack Exchange Network

Stack Exchange network consists of 175 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

Questions tagged [apexrest]

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

0
votes
0answers
24 views

Salesforce to IBM DB2 Integration [closed]

I am working on a requirement where I need to pull data from IBM db2 to Salesforce using the REST services. Has anyone tried it yet? I am not interested in the third party connectors.
0
votes
1answer
32 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/...
0
votes
0answers
41 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
38 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
92 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
44 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
20 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
14 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. ...
0
votes
0answers
25 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
26 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
21 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 ...
0
votes
2answers
61 views

Call Salesforce API Rest with python

I'm try to call a REST web-service I made on Salesforce from a Python script @RestResource(urlMapping='/test_rest_api') global with sharing class Test_RestAPI { @HttpPost global static void ...
1
vote
1answer
19 views

Can I change the accepted Root element of ApexRest?

Possibly a bad question, I am exposing a simple ApexRest Class to accept post's from an external source. example bellow: @RestResource(urlMapping='/user_defined_type_example/*') global with sharing ...
2
votes
2answers
178 views

Variable is not visible

I have this variable which returns key from custom settings. below is the code related to this private static String AccLinks { get { if (Acclinks == null) { ...
0
votes
1answer
33 views

how to provide username and password in test method for REST API

apex.runtime.impl.ExecutionException: pad block corrupted if (req.headers.get('username') != null&&req.headers.get('password')!=null && Authorization.decrypt(req.headers.get('...
0
votes
0answers
34 views

Test class for RequestData class [duplicate]

@HttpPost global static List<HHSurvey> getHHSurveyList() { RestRequest req = RestContext.request; RequestData mRequestData = (RequestData)JSON.deserialize(req.requestBody.toString()...
0
votes
2answers
55 views

Test method for request in JSON Format

Malformed JSON: Expected '{' at the beginning of object @HttpPost global static Void doPost() { //Initailizing variables String respString =''; ...
0
votes
1answer
58 views

How to change UserServicePresence in Salesforce and How to get the list of Status shared to a profile?

I have a requirement to create a Global Quick Action that would display all the "Service Presence Status" available to a Live Agent and Change the status when he selects any of the status available. ...
0
votes
0answers
32 views

Calling Salesforce Rest Webservice url from vf controller

Hi I am trying to make a rest callout from controller and I am not been able to get response . I am using apex continution callout pattern for this to make call async. This is controller class ...
0
votes
0answers
28 views

Can I use @Httppost and @Httpput on the same method

I want to use 1 method regardless of whether the request is sent as a Post or Put (upsert). So, if the request has an Id field populated, it will update the record, if not it will insert. Can I just ...
0
votes
1answer
40 views

Salesforce Unauthenticated REST - HTTP 301

I followed this tutorial, http://www.wadewegner.com/2013/03/creating-anonymous-rest-apis-with-salesforce-com/ , to create a public rest service in a developer sandbox. If I run any of the following: ...
0
votes
1answer
16 views

Assign a record as a look up object before insertion

I am attempting to write an api endpoint meant to upload many objects of one type. This object, MyObject, contains a lookup field that looks up another MyObject record for translation reasons. ...
0
votes
0answers
54 views

Docusign Salesforce integration with webhook listener

We are using Docusign REST integration in our managed package, but right now it is not real time. we send the sign envelope request to Docusign and then do the continous polling for response of the ...
0
votes
0answers
19 views

TestClass for @HttpGet to find locations based on geocodes [duplicate]

I am new to Apex coding and with lot of struggle I wrote the below apex class to find locations based on a Geocode custom object records. Now, I am having difficulties to write a testclass for the ...
0
votes
0answers
56 views

Getting Bad request for Connected App

I am using Connected app to authorize the access token but I am getting bad request. here is my code. public static void test(){ String clientId = 'REDACTED'; String clientsecret = '...
0
votes
1answer
38 views

How to execute class or method after update external id from post callout

I have a custom object in Salesforce with a set of fields. Some of the fields I sent over by an invocable method which calls a future method to send the first set of fields to entity in an external ...
0
votes
0answers
25 views

How to retrieve files from an external server

I'm not at all that familiar with web service, but we do have this requirement in which, once a month, we need to retrieve some pdf files from a folder in an external server, and then attach them to ...
1
vote
1answer
171 views

Invalid character in identifier in Wrapper class

I am doing a rest call with the below endpoint string endPoint = 'https://test.salesforce.com/services/data/v43.0/query?q=SELECT+Name+,+RecordTypeId+,+Code__c+from+Account'; I have the below class ...
1
vote
0answers
26 views

Anyone had a problem with a REST service exposed on a Site after an instance refresh

I have a REST service that I have exposed via a Site called public. It has a URL like this: https://company.secure.force.com/public/services/apexrest/my_service This service is use to receive ...
2
votes
0answers
24 views

Is there a way to specify an API version of a call to @RestResource?

I would like to specify an API version when I call a @RestResource via an API. Is that possible? Why For some reason, our Spring '19 sandbox is having a weird issue, and I'd like to fix this before ...
0
votes
1answer
192 views

How to create JSON string for REST callout from Wrapper class

I have found a lot of different examples of this, but I'm still having troubles accomplishing this. Here is the webservice which is working: //WORKING Webservice in target org @RestResource(...
0
votes
1answer
28 views

Rest API Response - Break Address into multiple fields

I am working on an assignment where we enabled an external system to search for contacts in Salesforce based on lastName, firstName, BirthDate. I have developed a webservice which queries the Contact ...
0
votes
2answers
41 views

Not able to call Custom Apex Rest API from Visual-force page in java-script (POST redirect to GET)

I have a requirement where I need to call my custom written Apex REST api from java-script in visualforce page, But somehow I'm getting that CORS issue which says my request has been blocked due to ...
0
votes
1answer
23 views

alternative way to traverse through json lists of lists of lists in apex

I have the attached json structure and just wondering is there a better way to traverse through the items to obtain them ? whatever i am doing is working and is shown below , but just would like to ...
0
votes
0answers
186 views

APEX REST Service permission in profiles and Permission Sets

I have code which makes Rest callouts to an external system for authorization and rest of the working. As per our design team APEX REST Service permission should be disabled. I tested out this is ...
0
votes
1answer
161 views

Calling Apex REST from node/express framework

I have to call an Apex REST API I created in salesforce from my node application. I have created the connected app in salesforce and required express and jsforce in my node application. But, I'm ...
0
votes
0answers
49 views

How can Customer community user login into Salesforce using REST API?

I have created one Rest webservice in SFDC (which I want to expose to other users) and set up one CUSTOMER community User. Login URL: https://test.salesforce.com/services/oauth2/token?grant_type=...
0
votes
1answer
206 views

REST API Call - Request Timeout

Hybrid Mobile App Cordova 8.0.0 Angular 1.7.5 Salesforce MobileSDK 6.2 Method - force.apexrest Issue - Salesforce REST API Call - Request Timeout (20%). Details - When the mobile app is hitting ...
5
votes
1answer
216 views

Implement pagination on APEX REST Endpoints

I am working on a Apex REST framework that acts as an abstraction layer to make it easier for all our other systems to consume data from salesforce (i.e. consistent naming scheme for field names, ...
1
vote
1answer
148 views

Cannot get apexrest api call to work - INVALID_SESSION_ID

So I would like to expose a custom rest api endpoint in sales force to access and update by custom object. My Apex Class looks like @RestResource(urlMapping='/v1/gcxintegrateddata/*') global with ...
2
votes
0answers
94 views

Authenticated Apex Rest Service for Partner Community Users

I have created a simple apex rest service that partner community users should access from an android mobile app. But I get a FORBIDDEN error saying "You do not have access to the Apex class named: xxx"...
0
votes
1answer
158 views

Webservice request from SoapUI not returning results

I am working on an assignment where I need to setup a webservice in Salesforce. The other system will have a search screen on their side and they should be able to search Salesforce for list of ...
1
vote
1answer
65 views

Unauthorized endpoint error due to port 444?

I am getting error during callout although I have added the url in remote sites. Can this be due to port 444 which other system has provided? What I can do to fix this as this is external system url ...
0
votes
1answer
34 views

Http send is not working with encoded url parameters

I created one class to make http callout to ftp server.I am using Http mock for test class.Sometimes ftp folders are created with space and it is required to encode the file and folder name in ftp url....
0
votes
1answer
27 views

Execute REST Class via Site

I have a class with a single method that creates some account records and related opportunities. These records are clones from another environment that I JSON serialized and I want to execute the ...
3
votes
1answer
57 views

How to save webhooks page data to Salesforce custom object?

In my requirement my webhook url having some data. when i am updating or inserting some data in my webhook page i want to save those data automatically in salesforce custom objects. Is there a way to ...
0
votes
1answer
103 views

Is getContent not supported in unit tests, even if HttpCalloutMock is used?

I have created REST Service to return content from supplied image URL. In @post method of REST Service, I have used page.getContent() method to retrieve image content. My REST Service is working fine. ...
1
vote
0answers
274 views

Send multipart/form-data to apex @HttpPost service

How I am currently doing this is, sending a raw JSON through Postman. This JSON is used to create a Case record in Salesforce. In order to attach a file to that case, the JSON contains a base64 ...
0
votes
0answers
72 views

Call Apex Rest Services from Community and maintain User Context

I have a community setup and an apex rest service. I've enabled the class for the community users profile and the guest user. The profile is api enabled and apex rest enabled. I can call the rest ...
2
votes
1answer
2k views

“message”:“INVALID_HEADER_TYPE”,“errorCode”:“INVALID_AUTH_HEADER” received

I am trying to call a rest resource within the same org (Because I am inserting records of an object developed by 3rd party and they strongly advised us to not do any DML directly rather they have ...