2

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've tested this by calling GET on /services/apexrest/namespace/Test/ and it returns successfully.

So now I want to call this same end point from the mobile sdk. Presumably using the net.sendRequest method from react-native-force.

But I'm not exactly sure on how to use it. I've got sendRequest('/services/apexrest/namespace/Test/', '', resolve, reject, 'GET'); Which I think? is correct. but I'm not sure on what should be in the 2nd parameter (path).

I've also tried variations such as:

sendRequest('/services/apexrest', '/namespace/Test/', resolve, reject, 'GET');

I've also tried:

    net.sendRequest(
        ...
        'GET',
        undefined,//payload
        undefined,//header
        undefined,//fileparams
        undefined,//returnbinary
        false//not requires auth
    );
3
  • What kind of mobile app are you building? I'm assuming hybrid given your code sample?
    – Matt Lacey
    May 28 '20 at 23:49
  • @MattLacey yep react native for both ios and android
    – Aequitas
    May 28 '20 at 23:50
  • @KrisGoncalves thanks for your input, unfortunately adding the api version does not work (with and without slash). I still get the same "URL no longer exists" error
    – Aequitas
    Jun 1 '20 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.