0

We're currently retrieving a list of Salesforce apps from the UI API using this function:

    net.sendRequest('/services/data', `${net.getApiVersion()}/ui-api/apps`,
      (e) => {
        setApps(e.apps);
        if (selectedApp) {
          if (!find(e.apps, { appId: selectedApp })) return setPage("AppSwitcher");

          setPage("Page");
        } else {
          setPage("AppSwitcher")
        }
      },
      console.error,
      'GET',
      { formFactor: 'Large', userCustomizations: 'true' }
    );

We're now attempting to migrate to SmartStore and SmartSync - but cannot find any documentation on how to query a REST API endpoint using SmartSync - i.e - what would we populate in the target section for syncDown:

  syncDownApps() {
    return syncDown(false, {target}, "apps", { mergeMode: smartsync.MERGE_MODE.OVERWRITE }, "appSync")
    .then(() => {
      console.log("Sync completed");
    })
  }
  registerAppSoup() {
    registerSoup(false, "apps", [
      {path: "Id", type: "string"},
      {path: "__local__", type: "string"}
    ]).then(this.syncDownApps);
  }

All current Salesforce documentation shows examples using SOQL. Thanks for your help :)

1 Answer 1

0

Here is the documentation about using REST API endpoints with SmartSync in React Native: https://developer.salesforce.com/docs/atlas.en-us.noversion.mobile_sdk.meta/mobile_sdk/entity_framework_endpoints_remote.htm https://developer.salesforce.com/docs/atlas.en-us.noversion.mobile_sdk.meta/mobile_sdk/entity_framework_endpoints_collect.htm

2
  • Thanks Brandon - reading that documentation it looks like it uses a model system where we need to know which fields we want before submitting the query? With the standard REST API call we're able to hit the endpoint and get a return with all the fields which is what we're looking for in our use case. Or have I misunderstood the docs? Thanks for your help! Jun 5, 2019 at 20:02
  • Yeah, the system was written based around the assumption that for the vast majority of cases we would know ahead of time how the soup is indexed. However, you may be able to get around this by using JSON1 since it will accept any type. developer.salesforce.com/docs/… Jun 5, 2019 at 21:56

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.