Start a new topic
Answered

Custom End-Point objects to Kinvey Entity

I have created a custom endpoint and it is supposed to return 10 kinvey entities just like KCSLinkedAppStore queries. However I get raw JSON objects that are not actual Kinvey Entities.

Please help as I think it's utterly important to be able to receive Kinvey entities from calling an endpoint.


  activityCollection.find({"fromUser._id":forUserId, "type": "follow", "content" : "accepted"}, function (err, docs) {
    if (err) {
      logger.error('Query failed: '+ err);
      response.error(err);
    } else {
            response.body = docs; // these should be Kinvey Entities, but instead it's a raw JSON
            response.complete(200);
        }
      });

 


Best Answer
Grisha,

I have confirmed this with the engineering team.

Custom Endpoints are not attached to an Entity class, for that reason we don’t provide a built-in solution in this case. You can definitely create an init method (as discussed earlier) or a custom parser for this scenario, or use an object mapper library of your choice.

You can also explore the 3.x version of the SDK where it would be a little easier to do the conversion since there is a better object mapping support built into the library.
http://devcenter.kinvey.com/ios-v3.0/downloads#

Thanks,
Pranav
Kinvey Support

 


Answer
Grisha,

I have confirmed this with the engineering team.

Custom Endpoints are not attached to an Entity class, for that reason we don’t provide a built-in solution in this case. You can definitely create an init method (as discussed earlier) or a custom parser for this scenario, or use an object mapper library of your choice.

You can also explore the 3.x version of the SDK where it would be a little easier to do the conversion since there is a better object mapping support built into the library.
http://devcenter.kinvey.com/ios-v3.0/downloads#

Thanks,
Pranav
Kinvey Support

 

Login or Signup to post a comment