Unable to complete "Retrieve object With API" task

Mission: CRUD ROOKIE
Task: Retrieve Object With API

Please, describe your problem here.
I have successfully executed the example Javascript code from this task and I can see the results displayed in the console:

JS Code (keys excluded for security purposes):

Backendless.initApp(APP_ID, API_KEY);

Backendless.Data.of('Person').findFirst()
  .then(function (object) {
      console.log('Object has been retrieved');
      console.log(`Name ${object.name}, age ${object.age}`);
      return object;
})
.catch(function (error) {
      console.log( 'Error ' + error.message);
      throw error;
});

Result:

Object has been retrieved
Name Joe, age 25
Done in 0.54s.

However, the task is never marked as complete. Is there something else that I need to do in order to complete this task?

Thanks,
Keith

Hi Keith,

Could you please check if the API tracking is enabled in your app? You can find on the Manage > App Settings screen:

Regards,
Mark

Mark,

Yes, I was able to verify that API Tracking was enabled. I kind of assumed so since I was able to successfully complete the prior “Add Object with API” mission successfully.

image

Keith

Mark,

I did a little more digging and it looks like the JS SDK findFirst function is calling the Find REST method (see screenshot below). Is this the same REST method that is expected for this mission?

Keith

Hi Keith,

You are absolutely correct! I forgot we changed the implementation, this was done to allow other filtering parameters to be passed to get the first object in a filtered subset. Thank you for digging in and reminding us about it.

I will check how I can get that task mark as competed for you. The simplest option might be going to REST console in Backendless console (there is a tab on the Data screen), copying the endpoint URL for the table, adding /first to it and fetching data in a browser.

Regards,
Mark

Thanks for the tip Mark! I was able to successfully complete the mission using the REST console and appending the /first path to the URL. I appreciate how responsive you have been on this issue.

Keith

How to use url and what is add at last

https://api.backendless.com/C3EAEEDF-C8CF-DCE5-FF5D-43F357954E00/BC6B158F-9071-4A1A-998E-6C295C674299/data/Person

Data retrieve but task not complete for doing this

@Rajesh_Verma,

To complete this task, it must be the API call to retrieve the first object. You can see the “Find first” API spec in the documentation at:

Regards,
Mark