I am using as reference this documentation: https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_favorites.htm

And it says that by doing an HTTP GET request to this url "/ui-api/favorites" it should retrieve "all of a user’s favorites.". But it seems it doesn't work.

I tried the following code in Execute Anonymous and received the error "HttpResponse[Status=Moved Temporarily, StatusCode=302]"

This is the code I tried in the sandbox, by the way I included some favorites to my user so it should retrieve something.

HttpRequest req = new HttpRequest();
string host = '{YOUR_SFDC_INSTANCE}.lightning.force.com';

String endpoint = 'https://' + host + '/ui-api/favorites';

Http http = new Http();
HTTPResponse res = http.send(req);


Does anyone know if the Favorite API is still in use? Thanks!

1 Answer 1


You have to go to Classic and copy the host Url.

Also the endpoint is not String endpoint = 'https://' + host + '/ui-api/favorites';


String endpoint = host +'/services/data/v45.0/ui-api/favorites';

where host is the base url in classic : eg: myPranyorg.salesforce.com


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .