Questions tagged [apexrest]

Apex REST enhances the Force.com REST API to allow developers to create custom REST-enabled web services using Apex.

Filter by
Sorted by
Tagged with
0
votes
1answer
16 views

Unable to obtain authorization token for partner community users

I have exposed an apex class as a rest service. I want my community users to be able to use the rest service to insert records in the system. I have set up a connected app to enable access using Oauth....
0
votes
2answers
36 views

Apex custom API request body is string for HttpPut [closed]

I am trying to create an apex api that upserts data into Opportunity object. The API has a request parameter and request body(string) that I need to consider (from mulesoft) Request Parameter is the ...
1
vote
0answers
27 views

Database.saveResult showing only one error at a time

I am trying to write an apexrest service that takes in fields for the Opportunity Object. There are certain restrict picklists on the Opportunity object that I've created. Additionally there are other ...
1
vote
0answers
10 views

Cannot test my own REST API from a beta managed package

I developed a REST API for my managed package which works correctly when tested for development in my scratch org but also as a released managed package. Recently I made minor changes to it - like ...
-1
votes
0answers
19 views

I am getting the Error 400 Not a multipart request

I am struggling from last week and getting same error please help me I am trying to upload pdf on the third party system I am using session id and URL to upload to PDF, It is working fine on Postman ...
0
votes
0answers
18 views

Issue with JSON Parse With Same attribute names in JSON

Here I have doubt How I Can Parse this JSON on apex and Get the data of "customerPurchaseOrderNumber" numbers, Here problem it is having same name of the json field/atrribute I don't how many it ...
2
votes
1answer
63 views

Multipart form data uploads only the first file when using HttpFormBuilder ( try with given RestEndpoint and Anonymous Apex)

I am using the same solution as Daniel provided : When I use the below method to upload file, one by one, it works fine, jpg, pdf, docx anything. But when I try to upload multiple files using the ...
-1
votes
0answers
16 views

org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Ef in state 2

I am Uploading Pdf file please help me, I am getting the error org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte Ef in state 2** public static void uploadFile(Blob ...
1
vote
1answer
32 views

Apex REST does not support multipart/form-data requests

From salesforce I Need to expose a webservice to accept pdf/txt files from Mule and once I receive I need to store in Salesforce as an Attachment. However, from Postman while trying to hit as below I ...
0
votes
0answers
18 views

I cant able to get more code coverage cant able to parse json deserilalize code [duplicate]

I am inserting multiple invoice and invoice items at using post web service REST API Bulkinsert_InvoiceInvoiceitems class @RestResource(urlMapping='/InsertInvoiceandInvoiceitems/*') global ...
2
votes
1answer
35 views

REST API custom 5xx error payload [duplicate]

I've written a rest service in Salesforce. In some cases I wish to give clients a specific return code and error payload to give them call specific information regarding the error with a JSON ...
1
vote
1answer
62 views

Using curl to make a REST API call

I need to call a rest API service in Saleforce from an external client. This application logins in Salesforce with the SOAP standard login service and then has to call some custom services. The ...
1
vote
1answer
33 views

Authentication that does not use oAuth

Is it possible to retrieve client id & secret without Connected App creating? As well - is it possible to use rest only with username, password and tocken?
0
votes
1answer
35 views

Argument cannot be null in Rest Apex class

I am trying to send data from salesforce to external system and have written web service but even after properly encoding every parameter, i am getting argument cannot be null due to which data is not ...
-1
votes
2answers
59 views

Empty request body when when using curl

I have a rest service in salesforce which it has to receive different requests. When I test the service sending requests, if I use a REST Client I am able to get the requestbody properly but if I use ...
1
vote
0answers
70 views

REST services getting empty result for User object

We set up a REST service to retrieve data from our org. Everything works great, except for the queries to the User object. When the query returns we get an empty list. This used to work (it was ...
0
votes
1answer
31 views

Show different class properties at different places

I am calling an GET API, where is am getting account details like name, number, ext Id etc. For parsing the response, i created a class like below. public class AccWrp { public String customer_no;...
0
votes
1answer
30 views

Custom APEX HTTP POST class fails to pass code coverage [duplicate]

I wrote a simple APEX class that should send some data as a HTTP POST request to some webhook. It receives some parameters as a collection and is called from a flow. global class send_sms_to_webhook {...
1
vote
1answer
34 views

Execute rest resource for post method from workbench

I am working on Data Integration Specialist Superbage, created below apex class with post method, I want to see the inputs from the workbench, but I am getting an error @RestResource(urlMapping='/...
0
votes
0answers
36 views

Apex batch job failing with “First error: Read timed out”

I have a batch job that is failing with the following error First error: Read timed out In the debug log, I got the repsonse as FATAL_ERROR|System.CalloutException: Read timed out When I ...
0
votes
0answers
46 views

Not Found / Forbidden error while using GET Operation in AWS S3 folder

I'm trying to get a csv file from a AWS s3 bucket, I've access to bucket and some of the folders in it. But i'm unable to access("GET") files from one of the folder. I get an error NOT FOUND"/404 when ...
-1
votes
1answer
35 views

How to only on field history enable object in apex?

We have 5 objects. In these objects, we are only tracking 3 objects field history, How can I query on enable history objects How how to get only field history enabled object Name Please help me in ...
1
vote
2answers
68 views

Logging Solution for Force.com Public RESTful webservice

I've created a public site with a RESTful service mentioned in this blog, however this site uses Guest User License and I can't see any debug statements when this webservice is used by Postman. Is ...
2
votes
1answer
98 views

Named Credential Authentication [duplicate]

I am trying to connect with Xero using Named Credentials. I am using oAuth2.0 authentication protocol. I have created a Auth. Provider and Named credentials as shown in the image below The Named ...
2
votes
1answer
69 views

What is best Option to store Access Token, Refresh tokens?

Platform cache : I am using platform cache but platform cache is not returning anything after very small period of time ( approx 30 sec- 60 sec ). Custom Setting : Custom setting has a limitation of ...
0
votes
1answer
147 views

Salesforce to Xero Integration Using oAuth2.0

I am trying to setup a connection between Xero and Salesforce using oAUth2.0. I am doing it as per the Xero Documentation mentioned here: https://developer.xero.com/documentation/oauth2/auth-flow ...
2
votes
1answer
28 views

ApexREST Websrvice StatusCode with ResponseBody

I am writing a REST Webservice and have the following piece of Code. @RestResource(urlMapping='/UpdateTransaction') global with sharing class OpportunityTransaction { @HttpPost global static ...
0
votes
3answers
59 views

Error Handling in REST Webservice

I have exposed this Apex class as a webservice. So far so good, as I get the response when this Webservice is called from ARC or POstman. @RestResource(urlMapping='/ProcessAccount/*') global with ...
2
votes
1answer
24 views

Bypassing Header Based Authentication

I am configuring a REST Hook between Salesforce and this marketing tool AutopilotHQ. Rather than having Salesforce continuously poll to find out when there is new information to trigger from, ...
0
votes
2answers
55 views

Apply pagination in Rest Resource

I have rest resource exposed to a external system. It is a simple rest api where i get a single parameter from the URL and query a custom object based on that param and return the results in a custom ...
0
votes
1answer
50 views

Composite REST Resource Not Found

I created a composite REST to insert opportunity for existing account, but all the GET method return error resource not found.. someone help { "allOrNone" : true, "compositeRequest" : [{ "method" ...
0
votes
1answer
40 views

JSON Formatting error

I have a requirement wherein I have to strictly format the body of the request as below. { "body": "* Case Number: 1406800\n* Primary Contact Name: Larry Brown Portal \n* Test:SampleTest" } ...
0
votes
1answer
25 views

Not able to view attachment in salesforce, when uploaded through Multipart Rest API

Below is the code which I'm trying to insert attachment through API not sure what is wrong, when I try to open 'Failed to load pdf' error comes or if I send image type file then that also doesn't open ...
1
vote
0answers
33 views

HELP API Callout error uncommitted work pending for bulk update

I created a batch class that calling an API and then update the records. This batch running every 5 minutes. And there`s a custom button, if I click that custom button, the batch will run only for ...
0
votes
1answer
57 views

How to send authorization to web app using Rest API [closed]

This is my first time working with API and I'm trying to understand how to send authentication to an web app using REST API. Questions I have: Do I need to setup Oauth in Salesforce in order to ...
0
votes
0answers
15 views

Set header and add header in rest Class

I have below class which i need to test it from workbench/postman. I am not sure how should i test it . @RestResource(urlMapping='/CheckAuth/*') global with sharing class example1 { @HttpPost ...
0
votes
0answers
34 views

How to access the REST API with the user with Permission 'Is Single Sign-On Enabled' is enabled

I have created one RestResourc to give the ability to the external system to attach the Report to Asset in Salesforce. Now the problem I am facing is the user which I am using for Authentication ...
0
votes
2answers
60 views

Salesforce Rest API, Issue in getting Params from Rest API

In the below code, If I print the String variable report, I am able to get only half of the string that is 123 characters, while the external person is actually passing me a string that contains ...
0
votes
0answers
56 views

Apex callout yields “Ending position out of bounds: -1” error

This is my vf page <apex:page controller="AccountRest"> <apex:sectionHeader title="Accounts" subtitle="List View"/> <apex:pageBlock> <apex:pageBlockTable value=...
0
votes
1answer
55 views

REST Endpoint Returns NULL in Test Class

I have a RestResource mapped to /Demo/ that I place on a Salesforce Site. The rest resource works great, including the parameters. However, in my test class I cannot get it to return anything to ...
1
vote
1answer
64 views

PDF file is getting corrupted when sending by HTTP callout to external system

on file upload below function is called in LWC. LWC Function uploadHelper() { this.file = this.filesUploaded[0]; this.fileReader = new FileReader(); this.fileReader.onloadend = (() =&...
1
vote
2answers
45 views

Query All Knowledge__kav records

I am stuck with weird situation. When I execute the following query SELECT Id, ... FROM Knowledge__kav Nothing is returned (0 records result) But when I execute the following query SELECT Id, ... ...
1
vote
2answers
74 views

HttpResponse[Status=BAD_REQUEST, StatusCode=400]

I'm trying to sending a field value to third part but here the issue is Suppose the filed is Name = "Test Account" here in this case call will be failed but for suppose Field Name is like Name = ...
0
votes
1answer
43 views

Auto Refresh Access Token

I have written this method to get accesstoken when I send Id & password given(Which I havent Hardcoded Below). I am saving my access token in custom setting and want it to expire, call this method ...
0
votes
0answers
132 views

Has anyone solved the error 415 (Unsupported Media Type) in salesforce?

Has anyone solved the error 415 (Unsupported Media Type) in salesforce ? I tried to upload a file to ContentVersion via rest api request but it 415 error will be returned by my org. Is there any ...
0
votes
0answers
39 views

Issue converting file object types to String format from an incoming OneDrive REST API call

I'm trying to pull a file object-type from O365 via the Graph API and I'm getting back a return-type that is pretty atypical to the normal JSON return format I'd expect to see. I'm not sure if it's ...
1
vote
1answer
154 views

Get the Info of a REST API Sender

Is there a way to get the Sender info in a Rest WebService? for example : Part A - Sender sends this JSON Via POST Request : Http httpProtocol = new Http(); HttpRequest request = new HttpRequest();...
0
votes
1answer
60 views

How do you create an endpoint in salesforce that accepts files (csv)?

I would like to create an apex service in salesforce that accepts csv files. Resolved this issue with the following: Created a public site which the FileUpload class is added. Since I need to create ...
0
votes
1answer
28 views

Simplifying REST API calls

I'm new to Java programming and I'm trying to reduce the number of REST API calls I make in my program to better organize it and I'm not sure how best to approach it if the simplest way is to have a ...
1
vote
0answers
27 views

Help writing Salefsorce Api call Test class

I have used some of the guides available like (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_httpcalloutmock.htm), but still having trouble ...

1
2 3 4 5
10