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 [rest]

The REST API provides a powerful, convenient, and simple Web services API for interacting with Force.com.

18
votes
2answers
22k views

Issues with connected App - {“error_description”:“authentication failure”,“error”:“invalid_grant”}

I've successfully implemented the oAuth2 authentication process using the Web Server Flow of the REST API between my application and Salesforce, and it's working great when connecting with a Developer ...
15
votes
3answers
7k views

Duplicate Matching Rules via rest API

So we are experimenting with the new duplicate matching rules in salesforce which seems to work great. My question is if its possible to use the more advanced features when working with data over the ...
12
votes
2answers
619 views

Apex Framework / library for consuming REST services

To consume REST services there is a lot of boilerplate code needed: Build Apex Objects to model the responses Code to deserialize REST responses to those classes Handling of HTTP requests, responses ...
12
votes
1answer
179 views

Image added through RestResource is not fully uploaded

I used this answer to make apex rest resource. It works perfectly for small images, but when I want to upload a bit larger image, the bottom part just gets cut. I was trying to upload this picture, ...
9
votes
2answers
851 views

ID query string parameter call to RestResource results in error

I'm looking to set up a RestResource endpoint that accepts some URL parameters and creates a lead record. Here's the basic gist of my code: @RestResource(urlMapping='/createLead/*') global with ...
8
votes
3answers
1k views

How to see JSON response for REST service?

How I can see what the JSON response looks like for a REST service that looks like the one below? I guess I'm looking for the actual steps of what I need to do to see the JSON response. @...
8
votes
3answers
3k views

“Session expired or invalid” problem calling an @RestResource from Apex in Winter '15 preview; UserInfo.getSession returns null for Force.com Sites

Based on threads such as Calling Apex Rest custom web service from Apex code we have HTTP calls in our Apex code (contained in a managed package) back to the same org authorized like this: ...
7
votes
2answers
3k views

What IP is my Salesforce calling from in my REST call?

I wrote a REST service to call another system from Salesforce. They have firewalls up and such and I instructed them to Whitelist the Salesforce force suggested IPs at Salesforce IP Address to ...
7
votes
1answer
3k views

What is the longest URI that Salesforce will accept through the REST API?

The Background I was handed a task to populate a developer sandbox with a limited set of data from our production org to allow another dev team to be able to test integration with a third party (with ...
6
votes
1answer
12k views

OAuth2 Refresh Token Flow - Unsupported Grant Type [duplicate]

I am attempting to obtain a token, using the Oauth 2 refresh token flow. I am using the REST Console in Chrome to perform the following POST operation: My URI is https://cs11.salesforce.com/...
6
votes
1answer
4k views

Could not find a match for URL Workbench

I am trying to test my code from workbench by sending an xml file to my @restresource global class. I have a @httpPost method through which I wan to insert the record. When I try to send a request to ...
6
votes
2answers
477 views

How do I enable REST Metadata API?

I am getting this error in Workbench when using the REST explorer: API_DISABLED_FOR_ORG message: The REST Metadata API is not enabled for this Organization. errorCode: API_DISABLED_FOR_ORG INFO: We ...
6
votes
3answers
11k views

Server-Side REST Authentication

We are trying to interface with our SalesForce instance via HTTP. The idea would be to call some of our custom classes from outside salesforce but without any user interaction. Typical scenario is ...
6
votes
2answers
822 views

How to prevent UNABLE_TO_LOCK_ROW via the REST API?

I have an app that uses the restforce gem to make queries against Salesforce. I ran into an issue with locked rows (UNABLE_TO_LOCK_ROW error), so now I would like to select Contacts, Leads, ...
6
votes
1answer
299 views

Cross Origin Domain Problem on Apex Rest Method

I have been using custom rest method for long time for file uploading and it was working properly. however last week , it started to throw error where the request is send. I have rest method in class ...
6
votes
1answer
47 views

Strip Authorisation header from inbound REST Request

I'm integrating with a 3rd party data provider. The way their platform works is you must provide an endpoint to which they periodically send REST requests to with updated data etc. They happen to ...
6
votes
1answer
3k views

REST API: “INVALID_SESSION_ID” with valid token

I'm having some trouble accessing API endpoints using a valid token that I just got from the OAuth process. I'm passing data as I think I should and am trying to access any endpoint at this point (...
5
votes
3answers
612 views

Lightning: Getting a 401 when calling @AuraEnabled Apex method to do a REST call

Trying to write an Apex method that accesses Chatter REST api using this technique: https://chintanblog.blogspot.com/2017/02/call-salesforce-rest-api-from-apex.html This method is @AuraEnabled - so ...
5
votes
1answer
901 views

RemoteAction Vs REST? Which is faster?

I need to get the results really fast on my page. I have to decide between 2 approach. Build a HTTP get service, by using a VisualForce page as Service. Using contentType as 'application/JSON'. Use ...
5
votes
1answer
9k views

System.CalloutException: Unable to tunnel through proxy. Proxy returns “HTTP/1.0 404 Not Found”

While trying to call REST web service, i am getting callout exception while doing authentication. follow is the Code spinet, ulr and token is updated for this example. Http h = new Http(); ...
5
votes
2answers
4k views

How to retrieve just the text without formatting from a rich text field using JSON?

I am querying a rich text field that contains text information using a public rest service using this method http://blogs.developerforce.com/developer-relations/2012/02/quick-tip-public-restful-web-...
5
votes
2answers
5k views

How can I tell from REST api which of an object's fields are required?

I am trying to create objects with the REST api, which works fine as long as I specify a value for each required field in the POST. The question is, how can I tell from the API which fields are ...
5
votes
1answer
127 views

JSON parsing with same attribute name

I am trying to parse the JSON Response from a Composite REST API call into a wrapper class. However, from the docs, "body" attribute in the response from a Composite Subrequest will be an Object in ...
5
votes
1answer
153 views

Proper/Safe Way to Link to Salesforce Object

What is the proper/safe way to get/generate links for Salesforce objects retrieved through the REST API? For instance, we have a tool living in another application that allows users to query for ...
5
votes
2answers
436 views

Site Guest User not allowed to make callout

I have exposed a Rest service method to public @RestResource(urlMapping='/webhook') global class Services { Private static String ACTION_PARAM = 'action'; Private static String ...
4
votes
1answer
971 views

Handle JSON array from REST call

I'm trying to do my first REST integration between PHP and Salesforce, and am having some trouble understanding how to handle the JSON objects. Basically I'm sending over a list/array of objects in ...
4
votes
2answers
7k views

What is the maximum number of records I can send per RESTful API call?

There is a maximum batch size for the number of records returned by an API call. Most of the documentation for the API calls reference including a .json file, and some, like the Update a Record page,...
4
votes
2answers
903 views

REST API Inbound Integration - Quick Question

Need your inputs for our following requirement. We have a team of folks who want to have a list of Cases (with selected fields) from our Salesforce instance. None of these folks have access or ...
4
votes
1answer
1k views

ExactTarget REST vs SOAP API

I'm impressed with ExactTarget's REST API; it's well considered, particularly its oAuth implementation. However, the services available in the REST API only provides a handful of core methods. The ...
4
votes
1answer
966 views

Integration with REST API that is not CRUD

I'm a developer working on an API that tries to be REST-ful, but is limited in terms of CRUD. Many entities expose a GET endpoint, but because many create and update actions have side-effects, we don'...
4
votes
2answers
622 views

How to get a record in workbench by passing record name with out using rest class

I knew that we can get record by passing id of a record in workbench and we can get a record by passing name of a record(using where condition) by using rest class. But i want to know that, (I ...
4
votes
1answer
1k views

Exposing same apex method via SOAP and REST API?

Is it possible to expose a single method in salesforce and make it available via soap and rest? I am looking at the docs and seems like you can't. For example on this page: https://developer....
4
votes
2answers
1k views

Possible Username-Password OAuth Authentication Flow security issues?

We have chosen to use "Username-Password OAuth Authentication Flow" over the "Web Server OAuth Authentication Flow" and "User-Agent OAuth Authentication Flow" because we need to login silently, ...
4
votes
1answer
743 views

Symbol Table References are Null - REST Call

I am trying to get the references for methods defined in Apex Class via Tooling API ( by REST Call ). Please find the information of the REST Call below ( using Workbench ) When i make the above REST ...
4
votes
1answer
720 views

Wrong Tags Parsing XML from API

I am trying to parse a file from our meeting server with XML data. The data is structured like this: <results> <status code="ok"/> <principal-list> <principal ...
4
votes
1answer
757 views

REST API vs SOAP API?

One of the differences between REST and SOAP is that REST is lighter than SOAP. What does it mean when they say REST APIs are lighter than SOAP APIs? How is JSON lighter than XML?
4
votes
1answer
89 views

Why Salesforce REST API List View Describe Method returns extra values in columns list?

When I try to execute this request GET /vXX.X/sobjects/{sobjectType}/listviews/{queryLocator}/describe which is described in documentation https://developer.salesforce.com/docs/atlas.en-us.api_rest....
4
votes
1answer
431 views

How can I limit REST API response to less than 2000 records?

I have seen several question that ask the opposite, how to overcome that limit. I need smaller response because some downstream issue I have with very long responses. I cannot use the LIMIT clause ...
4
votes
2answers
782 views

Format for attachments coming out of SFDC through REST

I could really use some help here. What is the difference between cURL and using the javascript Request module that would make the attachments coming out of one perfect and the other garbled? Here's ...
4
votes
1answer
437 views

Securing a REST API

Once the Connected App is created, how is access granted to various endpoints exposed as REST Services via Apex REST? For example, if we have a Class called CreateCustomer, and it is decorated like ...
4
votes
1answer
3k views

Salesforce REST API authentication?

I feel like this should be really easy to do, but I can't find anything about it on the web. Is there a way, through either javascript or a java web servlet, to skip the subsequent authentication? We ...
4
votes
1answer
1k views

Calling custom apex as REST with XML results

So you want to call your Apex classes from outside salesforce via RESTful HTTP and need XML resurned even though it's uncool. The official documentation suggests it's supported by simply adding the ...
4
votes
1answer
559 views

Is it possible to setup a web tab in Salesforce which will go to this KB without needing to login using username and password?

We have a Web KB that is built in PHP. Is it possible to setup a web tab in Salesforce which will go to this KB without needing to login using username and password? I initially thought that SAML ...
4
votes
1answer
146 views

Workaround for TLS

We are using a number of integration operations with different systems and some of those systems are not going to be updated to the TLS 1.1 cryptographic protocols or higher anytime soon. This systems ...
4
votes
1answer
3k views

Call Restful SFDC service from Java

I'm still working on getting the authentication working but having issues. I have been getting a 401 unauthorized error. All of the items I have hidden I am sure are correct values UNLESSS I need to ...
4
votes
2answers
1k views

REST OAuth connection for Bulk API queries

Is it possible to authenticate an OAuth app for the user and then make Bulk API queries on their behalf? The results are easily going to be more than 20k records each authenticated user. When I have ...
4
votes
2answers
650 views

REST Vs SOAP API for Email Content Creation in ExactTarget

This might be a newbie question, but here it goes anyway The Web Service Guide talks about Creating Email content using Web Services API (http://help.exacttarget.com/en/technical_library/...
4
votes
1answer
449 views

Unable to get access_token from salesforce

I'm trying to get a nodeJS RestAPI service in place that should get and post data to and from a Salesforce org. However I can find a way to get my access_token from Salesforce. I've tried with ...
4
votes
1answer
1k views

salesforce REST Api UPSERT on Salesforce ID?

Every attempt I make to UPSERT via REST results in a 405 error which reads: "errorCode": "METHOD_NOT_ALLOWED", "message": "HTTP Method 'PATCH' not allowed. Allowed are GET,HEAD,POST" I've tried to ...
4
votes
2answers
1k views

Decrypting Salesforce Encrypted Fields

I'm storing user passwords for an external web service in salesforce, in encrypted fields. Using the SOAP API in JavaScript, I wish to use the password in a REST request. However, I'm unable to ...