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-api]

REpresentational State Transfer (REST), or RESTful, web services provide interoperability between computer systems on the Internet. The Salesforce REST API provides a powerful, convenient, and simple Web services API for interacting with Force.com.

46
votes
5answers
11k views

How to call a Salesforce REST URL from Lightning Component?

I want to call a Salesforce REST URL from a Lightning Component. Specifically, I'm trying to call this Analytics API URL: /services/data/v32.0/analytics/reports. I see the following error in the ...
31
votes
1answer
24k views

Writing Test Classes for Apex RestService

I was writing test classes for my apex Rest Service that i had built for an ipad app. I noted very interesting things while experimenting.Before anything i just did a google and found an interesting ...
30
votes
1answer
5k views

Can I have a public APEX REST API?

Can I have a public APEX REST API e.g. APEX REST api that is accessible without authentication?
24
votes
5answers
5k views

Most API call efficient way to retrieve all attachment bodies

I need to download the binary body of all the attachments in my organization. I'd like to do so with the least amount of API calls. It is my understanding that the SOAP API returns a single attachment ...
23
votes
2answers
4k views

Callout loop not allowed error

I have an APEX REST POST method that is being called from an external system 'A'. Processing this POST I need to callout to another external system 'B' and based on its response continue with my ...
20
votes
2answers
32k views

Rest API Vs SOAP API in Salesforce [closed]

Can any one explain me what is REST API and SOAP API. Also the example scenarios where these can be used ?
20
votes
1answer
4k views

SOQL query to load Task returns nothing, but I see task in UI

I am trying to load all tasks of a contact via SOQL query: SELECT Id, Subject FROM Task WHERE WhoId = 'contactId' This query returns only partial list of Tasks. I.e. in UI I see tasks directly ...
20
votes
1answer
406 views

Records not being indexed or found with global search

I've come across an issue where Salesforce doesn't seem to be indexing records in a custom object that are created through the REST API. When searching for a record name or external ID no results are ...
19
votes
2answers
19k views

How can i integrate one SFDC org to another SFDC using Rest Api

I am trying to integrate one Salesforce org to other org by using Oauth setup, I wanted to use use consumer key and consumer secret key in my REST class to connect with the org, after connection part ...
17
votes
3answers
12k views

Salesforce: Any API for getting user information?

I am trying to find a way to get the information about the salesforce enterprise user from his auth_token. I want to find the username, email address and role(admin/user) from the auth-token. ...
16
votes
1answer
5k views

Two Way Authentication Into Salesforce?

Salesforce can use a SSL certificate to authenticate itself with a third party server, but can a third party server authenticate with a Salesforce in the same manner? Our use case is that we have ...
16
votes
2answers
2k views

Create Community User through REST API

I am using the nForce library with node.js. Everything seems to be right and we perform CRUD on the Case object. However when we try to create a User using an external account with "Delegated ...
15
votes
2answers
12k views

PATCH request using Apex HttpRequest

I'm looking for a way to create an HttpRequest in Apex using a POST method. When I do it, I hit this error: { "message": "HTTP Method 'POST' not allowed. Allowed are HEAD,GET,PATCH,DELETE", "...
15
votes
4answers
7k views

How can I add an @mention when creating a FeedItem via APEX?

I have found that this can be done via the Chatter API, and that there is a pilot program (http://developer.force.com/cookbook/recipe/connect-in-apex-pilot) to bring this to APEX, but I am not ...
14
votes
1answer
16k views

How can I return JSON object from REST service?

I used JSONGenerator to generate a customized JSON String. I know I can return sObject or String using Salesforce REST. But now I am sure I do not want to return sObject because I want the customized ...
14
votes
2answers
6k views

REST API without Connected App

I have to design an external app which will retrieve information from Salesforce. Any user can install this app and use it. This app will use rest API to access information from Salesforce. I cannot ...
14
votes
4answers
2k views

Why Salesforce.com logs the user in automatically after his/her session has been invalidated?

I'm logging in users via REST in my .NET application. For that in the WebBrowser control constructor I do the following: string server = "https://login.salesforce.com/"; var authURI = new ...
14
votes
3answers
4k views

Query Remote Site Setting?

Can we get all remote site settings in apex ? I would like to check if a remote site setting exists or not.
14
votes
1answer
5k views

Timeout error when posting blob data to the REST API from a VF page

I am attempting to use a newly added feature of the REST API which allows insert and update of blob data. I am doing so via the ajax proxy and I have been unsuccessful in posting a new blob Document ...
13
votes
2answers
10k views

Updating multi currency rates from Apex

I just looked in the Salesforce.com documentation for a way to update currency rates using Apex, but I have a vague feeling that this is not possible using standard features. I noticed that a couple ...
13
votes
3answers
811 views

Custom Apex REST API versioning

Are there any people who already implemented a custom apex REST api that requires versioning in order not to break existing applications who consume the web service? Do you know any best practices ...
13
votes
2answers
2k views

How do I set DML Options when using the REST API?

My question is nearly identical to an existing question. To summarize the problem, my case owners aren't receiving an e-mail notification when a new comment is added to their cases. Please view the ...
12
votes
1answer
6k views

System.JSONException: Apex Type unsupported in JSON: Object

I was trying to parse json to apex but i was getting System.JSONException: Apex Type unsupported in JSON: Object My apex code was public class patdetils77 { //public String strBody{ get; ...
12
votes
7answers
5k views

How do I send SMSes from Salesforce?

What would be the approach to create an SMS application (either in Salesforce or other language) to send SMS from Salesforce? Is it feasbile if the client-side process is done through a streaming API (...
12
votes
1answer
2k views

Can I create connected apps programmatically?

Is there a way to define connected apps w/o opening the UI? Has anyone already created apps like that? Any advice would be appreciated!!
12
votes
1answer
173 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, ...
11
votes
2answers
2k views

Is SOAP API becoming obsolete?

I have a requirement to Integrate Salesforce with SAP Business Objects(BOJ) to retrieve some data in Real time and display using VF page. I will send Account Id from Salesforce and retrieve Billing ...
11
votes
1answer
3k views

Setting up a Public REST API

I found a different question asking, "Can I have a public APEX REST API?" which led to a blog post explaining how to setup a public site to expose a REST API: Create your REST API in Apex as normal ...
11
votes
2answers
4k views

When to use Apex controller vs JS Remoting or REST

When developing a website or mobile hybrid application, what are the benefits of using the standard VisualForce page + Apex Controller design versus using a framework like AngularJS for controller ...
11
votes
4answers
5k views

Is it possible to insert multiple records in Salesforce using cURL at the same time?

I am using cURL to insert data into salesforce. It works with single record but I need to insert multiple records at a time. Is it possible to do so and is it possible via a REST interface?
11
votes
2answers
288 views

Is there an API that returns consolidated metadata including layouts?

I believe I saw some information about a recent REST API that provided consolidated metadata including layout information. (For use by e.g. a mobile app that wants to base its screens on the metadata.)...
11
votes
2answers
8k views

Redirect Uri Mismatch when URI's are the same

I've been dealing with this mismatch for the last two days, and am at my wits end. We have a development server set up (accessible from the outside), and I am trying to get my OAuth token back from my ...
11
votes
3answers
6k views

How to Search Workflow Rules or Validation Rules etc in Apex i.e. Metadata Search via Apex?

Recently I'm working on building something for developers/administrators - a handy 100% force.com app allowing to search metadata. Currently this app allows you to quickly search (from sidebar) custom ...
11
votes
2answers
1k views

Discovering API Limits via Custom APEX Rest API

According to the documentation, the Salesforce REST API returns a Limit Info Header with each request. So each REST API call gets a Sforce-Limit-Info: api-usage=18/5000 line returned in the response ...
10
votes
2answers
9k views

Can you use the LIKE operator in SOQL queries via the REST API?

As the title states, can you use LIKE in SQOL queries via the REST API? Even with this basic query: select Id from Account where BillingState like 'VIC%' I'm getting an error back: REST ...
10
votes
2answers
4k views

How to work around the 100 callout limitation?

We need to have the ability to make more than 2999 callouts to a REST service. Currently, we are getting a raised exception when the number of callouts is more than current limit for callouts. Thus, ...
10
votes
1answer
16k views

When do Sessions expire?

I note that Session Settings allows you to have sessions expire as often as low as 15 minutes. However, I believe this is related to browser sessions and sure enough they do time out as expected. ...
10
votes
3answers
12k views

How to Insert/Update multiple records in a single Force.com REST API call?

We can use the Force.com REST API to perform DML operations. I want to know if there is a way that we can insert/update more than 1 record using a single REST API call.
10
votes
1answer
8k views

Understanding Rest Apex and Webservice Limit

I'm implementing a webservice exposing an Apex Class. I was reading understanding execution governors and limits and I dont see clear enough the limit for my @RestResource. I only found some ...
10
votes
2answers
344 views

How can updated SObjects/CObject be queried/retrieved without duplicate or missing records?

Another way to ask the question: Are SOQL queries transactional/atomic on the second level? I am writing a data integration with salesforce using the REST API. I want to retrieve a list of updated ...
10
votes
1answer
127 views

UserType - REST vs SOAP

I am noticing a difference in the "User Type" field returned from the REST UserInfo Endpoint (link) vs the SOAP getUserInfo() method (link) as follows: SOAP Standard PowerPartner REST STANDARD ...
10
votes
2answers
1k views

Session expired or invalid

I am trying to build Salesforce to Salesforce integration using Named Credentials. Followed steps from below blog. http://www.jitendrazaa.com/blog/salesforce/salesforce-to-salesforce-integration-...
10
votes
2answers
7k views

Upload an Attachment via the Rest API

I'm having an issue uploading attachments via the REST API. When trying to upload attachment data (i.e. data about the attachment and the associated base64 binary data) I'm getting a 400 result (Bad ...
9
votes
5answers
3k views

Is there any documentation about using Client ID / Token with REST API to access Group and Professional Editions?

I have seen information about using Token with SOAP API, but REST API documentations doesn't say anything about it. Did anybody find useful hints on getting Token to work with Rest API?
9
votes
2answers
474 views

What user to login to Salesforce with in a connected app that monitors the realtime API

I'm developing a connected app that will be available in the App Exchange. I'm struggling to understand what user my app should connect to Salesforce as. The app has a component that monitors the ...
9
votes
2answers
6k views

screen scrape Salesforce with REST GET call from Apex

Consider this code snippet from my answer to rao's question: String requestUrl = '/services/data/v26.0/sobjects/User/describe'; Http http = new Http(); HttpRequest req = new HttpRequest(); req....
9
votes
3answers
2k views

REST Client Salesforce to Salesforce

I want to send REST request from one SF org to another. Is there any REST Client class/s which can handle the authentication and communication for me or I need to write my own classes?
9
votes
1answer
2k views

Can't invoke @InvocableMethod via the REST API

I've been trying to use the new Spring '15 functionality related to Invocable Actions / @InvocableMethod / @InvocableVariable using the current documentation: https://www.salesforce.com/us/developer/...
9
votes
1answer
5k views

apexrest: controlling HTTP error codes on exceptions

Is it possible to control what HTTP error code apexrest returns when an exception occurs in the code? By default it returns a 500 error and a developer who's working on the system that's consuming ...
9
votes
1answer
5k views

Whats the Actual meaning of ALL ROWS in SOQL?

I did the following 1)Deleted a record in sfdc and then ran the query using ' ALL ROWS' keyword and i could see that as per the documentation that data from recycle bin is also retrieved with ...