function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Roman RauerRoman Rauer 

Using API's without authentication

Hi there :)

i'm currently working on an native Android app for my company and ran into some problems with Salesforce lately.

I hope i can find some help here.

What i want to achieve:
The company has a lot of Accounts in Salesforce with 3 important fields for the app: Name, Business (Workshop or Parts Dealer) and location(latitude, longitude)
I would like to show those Accounts(Workshops/Parts Dealers) as markers on a google map in my Android app based on a radius around the user's current location. So it would be more than sufficient to get the data as JSON or XML(i read about sObjects, which would be nice too)

The app will be freely available on Google Play Store and every user should be able to see all the Workshops/Parts dealers around the world.

The problem i'm facing is that i can't find a way to fetch the data inside my app without authenticating every user with a Salesforce-Login. 
Which API is the best to use in this case?

It would be so awsome if anybody could help me with this problem.

What i tried so far: 
- SalesforceMobileSDK: If i extend SalesForceApplication i always end up with the Salesforce-Login Screen.
It seems that every client has to be authenticated for API-calls to work. I tried using the method "peekUnauthenticatedRestClient", but this method only works on full path URL's(e.g. "https://api.spotify.com/v1/search?q=James%20Brown&type=artist"), which isn't really practically for my Use-case.

- I feel like i read nearly all docs about salesforce api, but can't quite get my head around how to solve this problem, although it seems like to be a pretty common use-case.  

- would a salesforce-apex method which would select all records inside a set radius around the user's location be accessable without authentication?

Thanks for your help in advance!

Roman
Santosh Bompally 8Santosh Bompally 8
Follow this -> 
1) Write a Restservice to expose your data. 
@RestResource(urlMapping='/Account')
global with sharing class MyRestResource {

 
    @HttpGet
    global static List<Account> doGet() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
       List< Account>  result = [SELECT Id, Name, Business,Location FROM Account ];
        return result;
    }
  
}

2)  Create a Community and provide access to apex class and account object to the Guest user profile. 
    Samplecommunity url -> https://somedomain.cs16.force.com/communityname

3) Go to workbench and test your API using rest explorer 
    relative url ->  /services/apexrest/Account
4) Your public url will now be   https://somedomain.cs16.force.com/communityname/services/apexrest/Account 

Mark as Best Answer if it helps. 

Thanks, 
Santosh 

 
Roman RauerRoman Rauer
Thank you! 

That was exactly what i needed!
James Bowman 12James Bowman 12

Medzcure - The Online Medicine Store the world trusts! Yes, when it comes to buying all kinds of Generic medicines and healthcare products, people from every corner of the world put their trust and faith in us. It is accessible 24/7 and provides the fastest delivery. If you suffer from ED and Smart Pills you will get the Cheapest price as well as Free shipping from our site Medzcure.

Pain is a common symptom that can affect anyone, regardless of age or gender. It can be caused by a variety of factors, such as injuries, chronic conditions, or psychological issues. Understanding pain and its underlying causes can help you manage it effectively and improve your quality of life. In this blog post, we'll discuss the different types of pain, their causes, and available treatment options.

Visit Our Store: www.medzcure.com
 

tech clickytech clicky
Most of the people like to use FRP bypass apk (https://techclicky.com/frp-bypass-apk/) on their android. This is the best tool for that. 
blink healthblink health
When other pain drugs fail or are poorly tolerated, hydrocodone acetaminophen-5-325 mg treat severe pain. Acetaminophen is given to patients to ease their discomfort and bring down their temperature. There is no risk of dependency even after extended use.
However, taking too much acetaminophen might harm the liver and have negative consequences. Among the narcotic analgesics is hydrocodone. Withdrawing from hydrocodone (https://usablinkhealthstore.com/product-category/buy-hydrocodone-online/)is a medical emergency that has to be managed
VISit US:-https://usablinkhealthstore.com
French LeoFrench Leo
Having encryption enabled in the API and using https using TLS secures the channel and the information sent. Rate Limiting and Throttling: Limiting the number of requests that enter an API helps prevent abuse. See my web here: https://pestbye.ca/service/pestbye-service-areas/
tomb ralytomb raly
Over hundereds of many  wix templates for sale (https://presentybox.com/stephanie) , you can choose from a wide range of wix templates
Roy ThomasRoy Thomas

Genericpharmas is a great alternative to get medicines with just a few clicks. It is an international-based online drugstore that offers excellent-quality medications. Its main goal is to supply medications at an affordable price to the local drugstore.  Undoubtedly, this online drugstore works round the clock to offer such medicines; it is a great choice to buy medicine for sexual healthcare without leaving your medicines.

Besides treating over-the-top sleepiness, Artvigil 150 has many off-name utilizations, and experts across the world suggest it for the treatment of conditions, such as model, oppressive, steady exhaustion problems, Consideration Shortage Hyperactivity Issues, and A lack of ability to concentrate consistently Confusion.

For more information Visit at Genericpharmas.com
Putri riskiPutri riski
Terubuk, atau dalam bahasa Inggris dikenal sebagai "Malabar spinach," adalah salah satu bahan makanan yang sering kali terlupakan.  Namun, terubuk memiliki manfaat kesehatan yang luar biasa dan merupakan bagian yang unik dalam kuliner.  Dalam artikel ini, kita akan menjelajahi apa itu sayur terubuk, manfaatnya bagi kesehatan, serta penggunaan ikan terubuk dalam hidangan. Ngobrol Sehat (https://ngobrolsehat.com/) Mari kita mulai dengan deskripsi terubuk sebagai tanaman yang menarik.

Terubuk adalah sejenis tanaman hijau yang termasuk dalam keluarga basella. Tanaman ini tumbuh merambat seperti anggur dan biasanya ditemukan di daerah tropis. Hidup Sehat (https://hidupsehaat.tumblr.com/) Sayur terubuk memiliki daun hijau gelap yang tebal dan berbentuk jantung. Rasanya yang renyah dan sedikit asam membuatnya menjadi tambahan yang menyegarkan dalam hidangan. Selain itu, terubuk juga memiliki varietas bunga tebu yang indah, yang sering digunakan sebagai hiasan dalam masakan.
Paul Burke 17Paul Burke 17
Thanks for this sharing.
tiny fishing (https://tiny-fishing.com)
royi chanroyi chan
Thanks for this sharing.
tiny fishing(dash cam china (http://www.yuweitek.com/en))
Planet RDPPlanet RDP
Thanks. I was facing the issue and now I fixed it.
Buy rdp (https://planetrdp.com/)
John Wick 107John Wick 107
Thank you for your help. https://whatweather.today/
Bharat sharma 52Bharat sharma 52
Thank you for your help. https://23news.in/
Melisa BellMelisa Bell
Elevate your email marketing strategy with our expert email marketing in Dubai (https://writeitright.ae/services/email-copywriting-services/) services. Drive engagement and conversions efficiently.
henry smith 2henry smith 2
Salesforce helping lot of people with its useful content Connectios (https://connectionsgame.org/)
deepika mishra 10deepika mishra 10

Thanks salesforce team, i faced the same issue too but when i modified the code as said on the top , it got fixed for account.

Site: freetricksworld.com

royi chanroyi chan
Elevate your email marketing strategy with our expert email marketing in Dubai(https://en.yuweitek.com)(http://www.clothinglabelscustom.com)Thanks salesforce team, i faced the same issue too but when i modified the code as said on the top
Weber RalphWeber Ralph
You can authenticate with the username/password of a Service Account user you create specifically for your app. This avoids tying it to a specific Salesforce user. dino game (https://dino-game.co)
Jennifer MatasJennifer Matas
To access Salesforce data without user authentication, you can consider creating a RESTful web service in Salesforce using Apex, which selects records within a set radius based on user location. This approach doesn't require individual user logins and could be relevant in scenarios similar to car towing (https://towtrucktowing.com.au) truck where location-based data is accessed.
maria stokermaria stoker
BleachBit (https://file-downloaders.com/" target="_blank) is a piece of open-source software that may remove digital traces and temporary files from personal computers and other electronic devices. The primary objective of BleachBit is to provide users with full control over their data, particularly in relation to their privacy. 
Baku JainBaku Jain
Thanks Santosh for the help...May I know if i can follow it to get the same result for instagram reels download (https://reelssaver.org/)?