You need to sign in to do that
Don't have an account?
How to make apex class working for a connected app
I created a simple Apex class:
@RestResource(urlMapping='/somevalue') global with sharing class SomeValue extends Auth.ConnectedAppPlugin { @HttpGet global static String doGet() { return '444'; } }Also created a test for it:
@isTest public class SomeValueTest { static testMethod void testHttpGet() { String res = SomeValue.doGet(); System.assertEquals('444', res); } }
and it passed successfully - https://gyazo.com/58edea3a448a946406ba2e1c39c88b8b .
I also added it to my connected app as a Custom Connected App Handler - https://gyazo.com/b40da6eaefea584fd286ed62c2cfb147 .
I enabled all the scopes (think that isn't necessary).
When I login via oAuth using the account which I used to create the Apex class - the url 'https://myInstance.salesforce.com/services/apexrest/somevalue' gives me the correct value - '444'.
But when I login via oAuth (the same connected app) using other developer edition account - the url 'https://myAnothertherInstance.salesforce.com/services/apexrest/somevalue' gives 404 - Not found.
What else should I do to make it working for all users?
PS
I do this to know what should I do for my real Apex class.
If it helps please link and mark as correct, it may help others in the same situation.
for detailed steps, check - http://www.infallibletechie.com/2017/08/simple-inbound-rest-api-using-apex-in.html
Hi Agustin, hi Magulan,
thanks for your quick response.
Agustin, I don't think my issue comes from wrong tests, at least my test was passed - https://gyazo.com/58edea3a448a946406ba2e1c39c88b8b , and I didn't find my issue (not found 404 for other organizations). Anyway I changed my test making similar to their, but that didn't help. Do you think my issue comes from the test?
Magulan, of course I use access token from other org - my error is 404.