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
0answers
219 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
135 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
0answers
275 views

Deploy Apex Class to another Salesforce ORG via Metadata API?

So I've been looking around to see if there is a way to push Apex Classes via the Metadata API, and I'm a little confused at the documentation. I've used the Eclipse plugin before, so I know that you ...
3
votes
1answer
713 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
636 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
446 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
1answer
3k views

REST error handling design

I have created a very simple REST service to convert a lead: @RestResource(urlMapping='/ConvertLeadFromApp/*') global with sharing class RESTLeadConvertController { @HttpGet global static ...
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
2k 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
12k 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
434 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
192 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
5k 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
982 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
12k 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
2answers
938 views

Process JSON Array

Can someone tell me how to process JSON Array in an Apex REST resource class ?. My input to the HTTP post method will be like as follows. [ { "Name":"1 A" }, { "Name":"1 B"...
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
8k 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
298 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
437 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
2k 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
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
4answers
908 views

Calling a rest API from one Org to another Org?

I have created Connected App & Auth Provider. This is the Code i am currently running. Getting error. What I am doing wrong? Can anyone please help me with this? 1st Org - (Class ...
2
votes
1answer
275 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
38 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
187 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
803 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
142 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
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
3k 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
1k 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
499 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
1answer
209 views

Trying to get methods references using REST version of the Tooling API

I am trying to get methods references and external references using REST version of the Tooling API, but they all = null: /services/data/v36.0/tooling/query/q=Select+Id,Name,SymbolTable+From+...
2
votes
2answers
912 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
2k 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
1answer
37 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
931 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
7k 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
36 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
200 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 ...
2
votes
1answer
751 views

How to consume REST service created in salesforce

I created a rest service in salesforce as below: @RestResource(urlMapping='/v1/accounts/*') global with sharing class REST_Account_Service_V1{ @HttpGet global static Account doGet(){ ...
2
votes
1answer
371 views

Chatter REST API Limit

Is there any way to increase the Chatter REST API limit of one poll per minute is a hard limit and cannot be increased? We built a connected app using REST from a 3rd party portal application and ...
2
votes
1answer
599 views

REST SERVICE - Unexpected parameter encountered during deserialization

its all perfect! why is this happening? the same endpoint and JSON works in workbench but not in my java code: REST API : @RestResource(urlMapping='/RestTest/*') global with sharing class ...
2
votes
1answer
1k views

apex REST WEB SERVICE : Unexpected parameter encountered during deserialization: startdate at

I have a few json's that I'm posting with the access-token as header, when I send two parameters I get a status message from my rest api successfully, but when I send more than 2 parameters I get the ...
2
votes
1answer
51 views

Speed difference between Connected App created on Developer Edition vs Enterprise Edition

We use a Connected App to allow our clients (from different organizations) to authorize and provide our platform API access to their data. Our original developer set this Connected App up on our ...
2
votes
1answer
175 views

Simulate/fake long running REST request

I want to simulate / fake a long running transaction context - does anyone have any code which I can use to artificially extended my transaction context in a controlled way? Thanks
2
votes
1answer
36 views

Save error: Constructor not defined: [Sample11.EventData].<Constructor>(Id, Datetime, Datetime, String)

I'm trying to expose user related events using REST API but I get the error at line 33. Why? Error Line: EventData eveData = new EventData(eve.Id,eve.StartDateTime,eve.EndDateTime,eve.subject); ...