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
36 views

Empty request body using POSTMAN in Apex REST

I'm making a apex rest class and trying to test it with POSTMAN. I already manage to do the authorization part succesfully, but when i make the call i receive as a response this error: After viewing ...
0
votes
0answers
9 views

Temporarily Disable Users updating forecasts

We are using collaborative forecasting with type of Opportunities by territory. I have a need to disable users from entering their forecasts during certain period of time in a week. For example, every ...
0
votes
0answers
29 views

Not Able to download Picture from Picture URL programatically [closed]

I have picture URL from Salesforce(Sage People). If I click on the link, I am able to download the picture. As picture URL does not contains .jpg or .png , I am unable to download it programmatically(...
0
votes
0answers
76 views

Help on Illegal assignment from List in Apex

How can i place below data Into Map : ( caseInfoWrapper: [carrierId=, partyId=a1K2F000000lWJrUAM, product=SI, productType=Whole Life, stateId=AK] ) ...
0
votes
1answer
36 views

How to display 401 errors from Apex class as toast message in lightning component

HttpRequest req1 = new HttpRequest(); req1.setMethod ('GET'); req1.setHeader ('Authorization', 'Bearer ' + accessToken); req1.setEndpoint (...
0
votes
0answers
14 views

how to do a POST using content type as form-data apex

I am trying to do a POST using form-data. I am not sending any file content. This will be triggered from a trigger Contact cont = [select Email from Contact where Id = '0031X00000V7BN3QAN']; ...
0
votes
2answers
34 views

Rest API Test Class Problem

I am having some problem while testing my rest API Class. My main class is as mentioned there @RestResource(urlMapping='/ONB2__Subscription__c/*') global with sharing class SubsRecord { @HttpGet ...
1
vote
1answer
56 views

Responsive JSON data

Hi my requirment is : In RestExplorer, Get Method, When i pass below URL # /services/apexrest/partyInquiry?recordId=a1K2F000000Wsom I can get Results below Structure : { "caseInfo": { &...
1
vote
0answers
28 views

Exposing Apex REST Services using OpenAPI [duplicate]

I'm trying to find the recommended approach for exposing custom Apex REST services using OpenAPI(fka Swagger). I found most articles on Salesforce consuming OpenAPI spec in external services but ...
0
votes
2answers
31 views

Public REST Service Access Error

I am moving a guest user sites page REST service from a sites page implementation to a public guest community. It worked fine as a sites page REST service but I am having trouble porting it to a ...
0
votes
1answer
24 views

How could I get the full URL in apex class

How can I take the full url without affecting the "&" if i redirect to this page: https://XXX.XXX.force.com?pay=BXXXB&PA83747474&TOKEN=23444848 for example. I catch the url using:...
0
votes
0answers
35 views

Apex REST API “HTTP Method 'GET' not allowed. Allowed are POST” Issue

We have created an Apex REST API which is using POST method. when we consume the API from postman with below URL, https://TestDomain--pcsandbox.my.salesforce.com/services/apexrest/v1/updateAll but ...
0
votes
1answer
35 views

Apex rest service issue with HTTP Post method when i Access from Postman

i created Apex rest service and @HttpPost method , i am able call POST method & got data in request body successfully from workbench. but i had issue with when i try to access from Post man. i ...
0
votes
0answers
23 views

How to Queue inbound Rest API request

Is there a way, we can execute the inbound rest api callout to be queued like the outbound callout can be queued using future or Queueable interface?
1
vote
1answer
48 views

Grant types supported by the Rest API [closed]

I have created a Apex Class and exposed the data as a REST API like below. global with sharing class ReteriveSFAccountData { @HttpGet global static void doGet() { try{ } } ...
2
votes
0answers
70 views

Using Salesforce mobile SDK how do I call an Apex REST endpoint?

In my scratchorg I've got: @RestResource(urlMapping='/Test/') global without sharing class RestTest { @HttpGet global static String test() { return 'cat'; } } And in workbench I'...
0
votes
1answer
25 views

Assert for Test Class for Future methods without any DML operations

I am trying to write a test class for a @future method which makes a REST callout whose response is just 200 {"status" : "ok"}. It does not make any updates to records. I am finding it difficult to ...
1
vote
0answers
25 views

Session to connected app

I would like an API to behave dyanamically based on which Connected App is calling it. Is there a way to identify from the user session which connected App was used to create the session? I can then ...
0
votes
1answer
55 views

Convert cUrl to rest in Apex?

I have a curl request which I have to convert to a rest request in Apex. This is the request: curl https://api.stripe.com/v1/subscriptions \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=...
0
votes
1answer
54 views

Assertion in the Test Class for ApexRest

I have a Apex Class which is exposed as a Rest API, the method is current void like below @RestResource(urlMapping='/SFDataAPI/*') global with sharing class SFDataAPI { @HttpGet global ...
1
vote
1answer
68 views

Access token - expiration semantics

I am currently working on exposing the SF data as an API so the external system can consume it. I created a account for the external system to access the data through the API. Salesforce provides the ...
0
votes
1answer
20 views

How to parse multiple value for same param in custom REST API

So I have custom REST API with Get method where request parameter is PublicGroup Name and Response is list of Users from that publicGroup. @RestResource(urlMapping='/GetUsers/*') Global with sharing ...
0
votes
1answer
52 views

Getting error, “You have uncommitted work pending” after invoking rest method via Process builder

I found many resources available on stackexchange regarding this issue. We cannot make a callout after doing any dml. But i do not think i am doing any DML operation in my code. Logical flow of my ...
0
votes
1answer
21 views

My Apex class is calling Flow how to wirte test class for that Apex Class

I created one API which is calling Flow and flow is taking data from different objects and responding back to the API class. I want to write Test class for my API Apex
0
votes
0answers
38 views

Unable to use RestContext in VSCode

I had to start using VSCode from IntelliJ (Illuminate Cloud). Surprisingly, all my services are throwing compilation errors. @HttpGet global static list<Lead_Behaviour__c> getLeadByParams() { ...
0
votes
0answers
22 views

More than one GET request inside a Apex Controller class [duplicate]

I used Creating an endpoint in Salesforce and using REST API to externally access it tutorial to print a list of custom objects inside a Visualforce Page in Visualforce Site. I followed the tutorial ...
0
votes
1answer
28 views

How to add space in JSON while mapping to 2 field in Apex class?

I'm trying to map 2 fields Firstname and LastName to a Json Name field, when I call the API its displaying FirstNameLastName, how do i add space between these 2 fields? JSONGenerator gen = JSON....
0
votes
2answers
43 views

JSON deserialize is coming null When I'm testing

I just Tested this code, When I'm running this JSON not assigning to the variables it is coming NUll. String requestString='{"terms":{"customerCode":"sadasd","customerName":"sadasd","incoterm":"EXW","...
0
votes
1answer
38 views

Improve performance of a rest resource

I have a rest resource which fetches more than 10000 records. iterates the list using foreach and adds each record to a custom wrapper class list and finally returns the custom wrapper list as ...
0
votes
1answer
38 views

Best to go with single api user or need to create multiple users

salesforce is allready integrated with serviceNow ..MiddleWare is SnapLogic , we created one API user in salesforce , Now we have new integration project salesforce is integrate with HRC system here ...
2
votes
1answer
120 views

Implementing different endpoints in same rest api class

I'm trying to implement a web service in apex. I have two GET methods GET /application GET /application/status 1 had been already implemented in the following way. I am given the task to ...
0
votes
1answer
88 views

ApexRest HTTPPost - Testing using workbench

I have created an apex rest httppost class. This requires two parameters which are passed via response. I am trying to test this via workbench by passing two parameters. @RestResource(urlMapping='/...
0
votes
0answers
10 views

I need help for Test Apex class [duplicate]

I got 52% with this test code, Please give me some advice to improve the percentage for passing. @isTest global class BLmainMock implements HttpCalloutMock { global HTTPResponse respond(...
-3
votes
1answer
81 views

Sending Salesforce fields in JSON to external system Json generator [duplicate]

I have less experience in coding. I have a requirement to send Salesforce record to External system whenever we create a record in SF, create an incident in External system. I wrote a class and a ...
0
votes
0answers
39 views

How can i use “x-ms-meta-name:value” in Microsoft azure integration

HttpRequest req = new HttpRequest(); req.setMethod('PUT'); req.setHeader('x-ms-blob-type', 'BlockBlob'); req.setHeader('x-ms-date', timestamp); req.setHeader('Authorization', authHeader); req....
-2
votes
1answer
25 views

Not able to update account using rest API

I am trying to update account record using Rest ,but i am getting error **CALLOUT_RESPONSE [17]|System.HttpResponse[Status=Bad Request, StatusCode=400]** Code global class AccountUpdate{ static ...
1
vote
1answer
47 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....
1
vote
0answers
34 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
1answer
18 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 ...
0
votes
0answers
29 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
162 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
vote
1answer
381 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
19 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
39 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
150 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
39 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
49 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
260 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
76 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
33 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;...

1
2 3 4 5
10