We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [rest]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
1k views

ExactTarget REST API - Getting issues with /contacts/ and /campaigns/

I'm new with ExactTarget APIs, I'm using Php curl to request the ExactTarget REST API. Basically, I tried to create a contact: $array = array( 'contactKey' => 'test@test.fr', 'contactId' ...
3
votes
2answers
3k views

Delete list of object via REST API

Is there any way to delete a list of object via single request? I see a possibility to delete only one per request - Delete a Record
3
votes
1answer
151 views

Android REST Create Event

I am trying to create an Event on my salesforce Calendar. All I am receiving is a 400 error. Can anyone help me with what I am doing wrong or missing? Any help would be greatly appreciated. ...
3
votes
1answer
503 views

OAuth with Active Directory Single Sign On

I am writing a Java App that will integrate with Salesforce using OAUTH + REST. In normal circumstances without any single sign on everything is cool. But the same app might be used to work with ...
3
votes
0answers
252 views

How do I access a Rest endpoint on a scratch org?

I've set up a connected app and a rest endpoint on a scratch org but can't access it through either the workbench, Postman or client code. I get the following error in each case: 404 Not Found ...
3
votes
0answers
98 views

Unsubscribe MobilePush Contacts with Automation

I need to unsubscribe multiple Contacts from Push Messages with the help of external attributes. It is to be done within an Automation. The only way I see I can do this is the following: Get ...
3
votes
0answers
704 views

Is there a way to create an OpenAPI / Swagger spec for my Salesforce Account?

I've been using the Saleforce REST API for a while and I'm interested in using an OpenAPI / Swagger spec to auto-generate a SDK using OpenAPI Generator and Swagger Codegen. Is there a way to get an ...
3
votes
0answers
255 views

Another STRING_TOO_LONG problem, HTML text into a rich text area

I have a custom object with a rich text field, max size 131,072. Using the force.com REST API, attempting to add an entry with text size larger than about 63,700 characters (I have not pinpointed the ...
3
votes
0answers
144 views

why extra string append with the REST request?

I am trying to send this data to another salesforce org REST endpoint. map<string,Set<string>> mp = new map<string,Set<string>>() ; mp.put('Data1',new set<String>{'...
3
votes
1answer
808 views

Live Agent REST and CORS

I am trying to create a chat client using the SalesForce Live Agent REST API but I am running into an issue with CORS. Does the REST API support JSONP, if so do you have some examples, if not then ...
3
votes
0answers
652 views

Send PDF from Salesforce to EchoSign through Apex REST and EchoSign REST API?

How to send PDF generated from VF page to EchoSign through Apex Code and REST API of EchoSign? I'm getting error as "Content Type not Supported/ UNSUPPORTED_MEDIA_TYPE". Any idea? String ...
3
votes
0answers
457 views

Login Service Cloud user through the REST API

I am building a web portal for the SalesForce Service Cloud using the REST API (PHP/WordPress Project). I need Service Cloud users to be able to login to the site through the API without being ...
2
votes
2answers
8k views

Get full URL (including querystring) from an apex REST endpoint

I have set up an apex class as a REST endpoint for an HTTP GET request that an external system is sending. We're having some trouble with it and they want me to send them the request detail. How do I ...
2
votes
3answers
3k views

Generate new password and notify user immediately

While creating new users from Salesforce UI, we have a checkbox right at the bottom called Generate new password and notify user immediately. This is set to true by default and sends Welcome To ...
2
votes
1answer
15k views

Rest API working well from Postman doesn't work from Salesforce

I am beginner to REST APIs. I had a REST api used to login into some third party application. When used from Postman extension of Chrome it works well. However throws some generic error when used from ...
2
votes
3answers
608 views

Getting JSON_PARSER_ERROR while parsing JSON

What am i doing wrong due to which i am getting JSON_PARSER_ERROR, I am using code below to parse json below : @RestResource(urlMapping='/Imbellus/CandidateScore') global with sharing class ...
2
votes
1answer
204 views

Rest API Logging 400 JSON Error

I created an API that has error handling inside of it. However if the payload does not match what the API is expecting, the code inside the API does not execute. Thus it does not log an error to ...
2
votes
1answer
7k views

What is the default timeout for httpRequest?

What is the default timeout for httpRequest. I have gone through this doc . But could not find the default timeout. public class HttpCallout{ @Future(callout=true) public static void ...
2
votes
1answer
1k views

Call a method from my @httpPost

I may @restresource I wan to call another method from my @httpPost. Is it possible. When I try I am getting error : Method does not exist or incorrect signature: xmlReader(String) Is there any way to ...
2
votes
2answers
1k views

Salesforce integration with external system: Calling REST service API from Salesforce synchronously on record create and update event

We are trying to integrate external system with Salesforce. Requirement is, whenever a record of a Custom object is created or updated in Salesforce, this event should synchronously call out to a ...
2
votes
1answer
2k views

SOQL Query Opportunities REST API

First time post here and I'm quite new to the SF ecosystem as well. I'm currently trying to figure out how to properly form queries using SOQL + REST. Ideally what I am trying to do is query an ...
2
votes
1answer
13k views

Rest API (POST method) with Jquery

So I am using Jquery Ajax with rest API trying to create Account Record using POST method but getting error <apex:page> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/...
2
votes
1answer
2k views

Insert multiple SObject data in Salesforce as single transaction using REST calls

I am using following soObject call to insert new row in the Account table at Salesforce server : curl -H "Authorization:OAuth use your session_id" -H "Content-Type: application/json" -d @Test.json "...
2
votes
1answer
9k views

503 error in rest api

I am calling below webservice when i update the record in account object, trigger calling the webservice but when i used below webservice i am getting 503 error i am follwing the below link http://...
2
votes
1answer
401 views

APEX Deserializing/Parsing RESTful JSON Webservice Response

I'm trying to get JSON data from a RESTful webservice into SFDC. My attempts have failed as I keep getting the following error: System.JSONException: Malformed JSON: Expected '{' at the beginning ...
2
votes
2answers
518 views

REST sobjects, how get owner.name instead of owner.id

Do you know if it's possible to get owner.name instead of owner.id via services/data/v41.0/sobjects/Entity?
2
votes
1answer
3k views

Rest Api: “HTTP Method 'PUT' not allowed. Allowed are HEAD,GET,PATCH,DELETE”

I am trying to update a contact record using rest api but facing issue like POST method is not allowed. If I use PUT method. it is also not allowed I have tried this solution How can I make a ...
2
votes
2answers
1k views

Code coverage for @HttpGet / Rest method

i'm trying to do a test method to cover a @HttpGet method. I'm pretty new on apex and i don't really understand how test (method/class) works for this kind of things. Here is my method : @...
2
votes
1answer
1k views

URI of Apex REST Class

I have created the following class @RestResource(urlMapping='/Expense/*') global class ExpenseWS { @HttpPost global static void createExpense(String ExpenseName,String Type,Integer Amount) { ...
2
votes
1answer
397 views

How to connect to a third party REST API using OAuth?

I have a third party REST API that needs to be called from Salesforce, using OAuth for authentication. Is this actually possible? If so, how? I really can't find anything useful on the web. For me, it ...
2
votes
1answer
50 views

Why am I not able to parse valid XML straight from the Salesforce Documentation, but JSON works fine?

On this particular page: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_methods.htm About halfway down, you'll see a method which I have included in my class @...
2
votes
2answers
220 views

OAuth flow for using my app as the authenticator

I'm using SF Restful API to develop an app. A generic use case of the app would be: User logs into the app (app specific credentials) User requests data available @ SF. App knows that user is allowed ...
2
votes
2answers
1k views

How to Query ApexLog raw body?

I need to find, in ApexLogs raw bodies, references to a given String value. I know we can query the object ApexLog fields, by using the following code: SELECT id, loguserid, ...
2
votes
1answer
176 views

RestResource Annotation - UrlMapping is NOT allowed

As per the Salesforce Article Winter / Spring '18 Apex Compiler Changes it is mentioned that UrlMapping is NOT allowed for @HttpPost UrlMapping and URL strings are NOT allowed for @HttpGet but there ...
2
votes
1answer
4k views

System.JSONException: Unexpected character ('}' (code 125))

I am passing the below JSON structure using POST method to a apex service: I get an error at line where the codes variable ends { "PId" : "345", "Description" : "test", "Codes" :[ { "Code" : ...
2
votes
1answer
2k views

JSON deserializing the scientific notation

I have JSON response data which has some scientific notation e.g. -1.E-2 , when we trying to de serialize with JSON2APEX, it is giving the Error as invalid input FATAL_ERROR System.JSONException: ...
2
votes
1answer
544 views

JSON deserialize single string

I'm trying to get the name value from an object. I tried everything but still dont get it. Any ideas? Http http = new http(); HttpRequest request = new HttpRequest(); request.setEndpoint('...
2
votes
2answers
1k views

Rest api HttpGet issue

I have created a class for api request. I am also sending a parameter in url while requesting for HttpGet. How can I get the value from the url in a HttpGet method. When I added the RestRequest req, ...
2
votes
1answer
3k views

REST Webservice @HttpGet

I am having trouble compiling a REST webservice class that I have created. @RestResource(urlMapping='/LeadSAP/*') global with sharing class SAPLeadWS { @HttpPost global static String createNewLead( ...
2
votes
1answer
3k views

Illegal Value for primitive when trying to parse the json data

I am facing the issue like "Illegal Value for primitive" when trying to parse the json data.Below is the Json Response which i get from a service. [{"revenue": {}, "emails": [{"grade": "A+", "type": "...
2
votes
2answers
6k views

how to call rest API from Html or javascript

i have one rest class for insert account , it's working with workbench.developerforce.com but now i want to call same using HTML or JavaScript , how can i do ? My Code : @RestResource(urlMapping='/*...
2
votes
1answer
2k views

Debug Log not working with RESTResource

I have the following class: @RestResource(urlMapping='/myservice') global with sharing class MyService { @HttpPost global static String newMessage() { RestRequest req = RestContext....
2
votes
1answer
39 views

How to find all Events with a specific URL in the description?

I keep getting a MALFORMED_SEARCH error for this find using the REST API: FIND {"http://www.google.com"} IN ALL FIELDS RETURNING Event After removing one character type at a time, it seems that the ...
2
votes
1answer
1k views

How to get the server timestamp through SOQL query or REST API?

This question was asked before, but the answer given was how to do it with Apex, and I am not using Apex: How to get the current timestamp using SOQL query? How do I do the equivalent of ...
2
votes
1answer
898 views

Salesforce to Amazon S3 - policy and signature generation

Description In order to upload files from a visual force page to s3 via AJAX. I had to find a way to generate a valid s3 policy and signature. The issue How to generate a signature and policy in ...
2
votes
1answer
9k views

Upload files to a Case in SalesForce via REST API

I'm working on uploading attachments from my website to Salesforce, attachments should be related to case object. I'm using REST API in PHP. So problem is that I get an error when I tried to upload ...
2
votes
2answers
66 views

Calling REST APIs based on a session established via a community login

I'm currently dealing with an authentication issue with two different Salesforce REST API endpoints. We are trying to consume the API from inside a Visualforce page in a Salesforce community. To do ...
2
votes
2answers
47 views

Which endpoints are supported for OAuth2 token authorization?

Documentation says that for OAuth2 token authorization URL like login.salesforce.com should be used For authorization: https://login.salesforce.com/services/oauth2/authorize For token requests: https:...
2
votes
1answer
64 views

Third party wants to call Salesforce.Can we use named credentials in this case

i have a use case where Some code has been written in salesforce and Third party wants to call it.They are calling using rest like this. https://xxx.com/services/oauth2/token?grant_type=password&...
2
votes
1answer
303 views

Composite Api Objects and Referencing RecordTypes

Is there anyway to reference an account recordtype by Name when creating an account using Composite API which has recordtypes? I am hoping there is a way so I don't need to do a get request to get a ...