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
Make your voice heard. Take the 2019 Developer Survey now

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
1answer
27 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
10 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
27 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
15 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
18 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
45 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
19 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
1answer
25 views

Not able to call Custom Apex Rest API from Visual-force page in java-script

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
22 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
20 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
48 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
23 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
63 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
56 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
61 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
39 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
41 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
34 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
0answers
15 views

Making API Calls to tooling api from Lightning component [duplicate]

I am getting the following error when my lightning component controller is doing rest callouts to the salesforce tooling api {"message":"This session is not valid for use with the REST API","...
0
votes
1answer
30 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
25 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
41 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
39 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. ...
0
votes
0answers
18 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
vote
0answers
81 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
33 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 ...
1
vote
1answer
911 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 ...
1
vote
2answers
38 views

Issue getting Salesforce Data Using REST API

Well, first am all new into the REST API's. I am not getting what I am doing wrong. Below are the steps I am following: Created a Lightning Connected App and got CONSUMER_KEY and SECRET_KEY. Hitting ...
2
votes
1answer
80 views

UserInfo.getSessionID() or connected app with consumer key and secret for a rest resource within a same org

I have a rest resource (developed by a vendor) that I am calling in my batch apex class that posts some data. The code is as below and works in partial and dev sandboxes but not in full sandbox as the ...
0
votes
1answer
154 views

Script-thrown exception in Test class for Batch apex callout

I have a batch class which makes multiple http callouts to an HR system and then with the absences returned checks for existing absences and upserts. However when I try and run test class for the ...
0
votes
1answer
18 views

Getting attachment thu REST AP

Kindly help me in resolving the issue. I am not able to parse the response from the json data. I need to get the Body part of the attachment. It's giving the error 'Required field missing' a.Body. I ...
1
vote
1answer
179 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 ...
7
votes
3answers
349 views

Ability of Apex Rest services to accept 50MB file, how is the heap size calculated in this case?

I have the below code where in we are accepting the blob data from the REST Apex class. We are inserting the document (blob) that we are receiving as a feed item. I was able to send file sizes upto 54 ...
0
votes
1answer
45 views

Calling rest resource (Post) within the test class

I am working with a supplier who proscribes DML operations on its application's objects. Instead, they ask us to call Rest resources in our org that they developed in order to interact with the data. ...
0
votes
1answer
19 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 ...
0
votes
0answers
18 views

How to get pardot's prospects back up into salesforce's custom object using pardot api

I have requirement where I need to backup all the pardot propects from pardot to salesforce's custom object. Is there easy way to do it ?
0
votes
2answers
91 views

Test class problem for below apex web services class [duplicate]

I'm trying here to write a test class for below apex class, I'm getting the below error when in the compilation: Methods defined as TestMethod do not support Web service callouts Test class: @...
0
votes
1answer
268 views

Delete multiple records using REST Api

I am trying to delete multiple records using REST Api. using below url https://xxx.salesforce.com/v43.0/composite/sobjects?ids=00P0K000016YabaUAG,00P0K000016YabaUAG but in response I am getting 405 ...
1
vote
2answers
131 views

Getting null for inner classes in complex JSON deserialization

I am trying to parse a nested JSON and have generated the apex code using JSON2Apex as below: global with sharing Class ServiceUpdates { @HttpPost global static void updateservice()...
0
votes
1answer
30 views

Need Apex REST Endpoint to Return HTML Page

I'm trying to use Dotmailer's external dynamic content to render dynamic content for an email from sfdc data I initally almost had this working using a visualforce page exposed in a force.com site, ...
0
votes
1answer
12 views

Can we update transactionSecurity Policy using rest api or meta data api?

Can we update transactionSecurity Policy using rest api or meta data api ?i tried with rest api,its not supporting updation and in meta data its throwing unknwn type.
0
votes
0answers
34 views

forcetk restapi broken in visualforce page (not in lighting container)

The following code was working fine until few months back, but now it is broken and giving an error as below: var params = { 'Type': 'Folders' }; var forcetkClient = new forcetk.Client(); ...
0
votes
1answer
127 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
67 views

Authorization using certificates

I want to know the process of authorization or authentication using self-signed certificates. I am trying to integrate two salesforce dev orgs using REST callouts. I have created a self-signed ...
1
vote
1answer
119 views

Not able to authenticate aws from apex

Below is the code I'm running from apex execute. Error received - signature mismatch error... Able to authenticate using postman String formattedDateString = Datetime.now().formatgmt('yyyyMMdd\'T\'...
6
votes
1answer
101 views

Call Salesforce from AWS : Platform Events vs Custom Rest Service

Our's a real-estate client who stores Property record's image in AWS. As the user uploads photo in AWS, we need to identify the Property record based on the Image name and update its field in ...
-1
votes
1answer
34 views

How do you perform JSON parsing in Apex scripting? [duplicate]

I obtained some JSON output from a REST response and I want to parse that directly in my Apex script to either run if-tests or determine which JSON key contains information to run further actions. ...
16
votes
1answer
550 views

Apex Rest Vs Platform Events for Inbound SF integration which one to choose?

Am in a design dilemma in choosing which would be the best approach in the Integration which we would be doing shortly. To give a brief idea, the external system wants to send JSON data to SF. We ...
0
votes
1answer
51 views

Unable to access a Sharepoint file using getBodyAsBlob. Get httpresponse 302

I'm trying to download a file from Sharepoint Online to a Salesforce folder using Apex REST and I'm running into an issue where I can read and access the file just fine using the Postman REST client, ...
0
votes
2answers
176 views

Clear platform event limits?

Where can I find clear docs on the API limits for sending platform events IN to sfdc? The platform events basics trailhead notes that: provides allocations for how many events you can define in ...