Dealing with __objectRef, __arrayRef, __originSubID

Problem description:
I’m using REST API

  1. when using backendless Data API I’m getting:
{"__originSubID":"FF388204-89ED-BBF8-FFB5-4DC6C58E0400"}

instead of real objects in json
2) when using backendless Custom API (Business Logic) I’m getting smth like:

{"__objectRef":"1234"}

or

{"__arrayRef":"1234"}

I’ve already got that it is an optimisation and that in sdk it is working ok.

But I have few question:

  1. Can I disable such optimisation somehow?
    if not:
  2. Are there any other possibility to avoid such behaviour without big losses in performance?
    if not:
  3. It is pretty obvious about how to map __originSubID, but how can I deal with __objectRef, __arrayRef ?

Thanks in advance.

Hi Oleg,

You can’t disable this fields either there are not any another possibility to avoid such behavior because these fields are being used by the server for support related data objects.
These are service fields and it shouldn’t be used by users in the majority of situations.
Please, describe your use case. Why do you need to operate with this fields?
Regards, Ilya

Hi Ilya,
The problem is that I’m getting json response from backendless, where instead of real objects I’m getting __objectRef, __arrayRef, __originSubID, for ex:

[spoiler=“json response”]{
“offset”: 0,
“data”: [
{
“children”: [
{
“children”: [],
“created”: 1465215069000,
“name”: “Device parametrisation”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “5E164AB6-FA0A-58B1-FFF7-E790958DF300”,
“updated”: null,
“objectId”: “29F9AF77-56C3-8F46-FFD8-B92101BFE300”,
“pcck”: “P-19-02”
},
{
“children”: [],
“created”: 1465214991000,
“name”: “Trusted Wireless 2.0 I/O”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “30D2CA82-82D8-3FE4-FFC4-3EF3A80B7C00”,
“updated”: null,
“objectId”: “75C2970D-2E76-67FA-FF46-D7124501EE00”,
“pcck”: “P-26-03-05”
},
{
“children”: [
{
“__originSubID”: “5E164AB6-FA0A-58B1-FFF7-E790958DF300”
},
{
“__originSubID”: “30D2CA82-82D8-3FE4-FFC4-3EF3A80B7C00”
},
{
“__originSubID”: “BBA65548-1B9C-9959-FFCE-F3D63A881800”
},
{
“children”: [],
“created”: 1465215076000,
“name”: “DC charging cables”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “BBF8EE6E-A083-8944-FFE9-2FEB8B53B400”,
“updated”: null,
“objectId”: “B8E5D92A-6323-D845-FF06-5F355678A800”,
“pcck”: “P-10-06-01”
},
{
“__originSubID”: “4221680D-E5D6-EFC1-FFA1-869EE6256F00”
},
{
“children”: [],
“created”: 1465215020000,
“name”: “EtherNet/IP™”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “C325AF86-68C4-4441-FFA1-3F0AF8880E00”,
“updated”: null,
“objectId”: “EE3E126F-2ED6-ACE2-FF58-F8D160943200”,
“pcck”: “P-04-07”
}
],
“created”: 1465215085000,
“name”: “Power supplies with max functionality”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “BBA65548-1B9C-9959-FFCE-F3D63A881800”,
“updated”: null,
“objectId”: “9A588714-C2ED-6AB6-FF2C-842994E90000”,
“pcck”: “P-22-03-06”
},
{
“__originSubID”: “BBF8EE6E-A083-8944-FFE9-2FEB8B53B400”
},
{
“__originSubID”: “4221680D-E5D6-EFC1-FFA1-869EE6256F00”
},
{
“__originSubID”: “C325AF86-68C4-4441-FFA1-3F0AF8880E00”
}
],
“created”: 1465215089000,
“name”: “Conventional safety relays”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “4221680D-E5D6-EFC1-FFA1-869EE6256F00”,
“updated”: null,
“objectId”: “E5F2C6DA-3278-CA05-FF5B-6FE8EA341500”,
“pcck”: “P-05-01-01-03”
},
{
“children”: [
{
“__originSubID”: “5E164AB6-FA0A-58B1-FFF7-E790958DF300”
},
{
“__originSubID”: “30D2CA82-82D8-3FE4-FFC4-3EF3A80B7C00”
},
{
“__originSubID”: “BBA65548-1B9C-9959-FFCE-F3D63A881800”
},
{
“children”: [],
“created”: 1465215076000,
“name”: “DC charging cables”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “BBF8EE6E-A083-8944-FFE9-2FEB8B53B400”,
“updated”: null,
“objectId”: “B8E5D92A-6323-D845-FF06-5F355678A800”,
“pcck”: “P-10-06-01”
},
{
“__originSubID”: “4221680D-E5D6-EFC1-FFA1-869EE6256F00”
},
{
“children”: [],
“created”: 1465215020000,
“name”: “EtherNet/IP™”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “C325AF86-68C4-4441-FFA1-3F0AF8880E00”,
“updated”: null,
“objectId”: “EE3E126F-2ED6-ACE2-FF58-F8D160943200”,
“pcck”: “P-04-07”
}
],
“created”: 1465215085000,
“name”: “Power supplies with max functionality”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “BBA65548-1B9C-9959-FFCE-F3D63A881800”,
“updated”: null,
“objectId”: “9A588714-C2ED-6AB6-FF2C-842994E90000”,
“pcck”: “P-22-03-06”
}
],
“nextPage”: “https://api.backendless.com/v1/data/Category?pageSize=2&offset=2&relationsDepth=1”,
“totalObjects”: 6
}
[/spoiler]
or from custom API I’m getting smth like next:

[spoiler=“json response”][
{
“___jsonclass”: “com.mop_demo.models.Category”,
“children”: [
{
“___jsonclass”: “com.mop_demo.models.Category”,
“children”: [],
“created”: “1465215069000”,
“name”: “Device parametrisation”,
“___class”: “com.mop_demo.models.Category”,
“ownerId”: null,
“updated”: null,
“objectId”: “29F9AF77-56C3-8F46-FFD8-B92101BFE300”,
“pcck”: “P-19-02”,
dates”: [
“1465215069000”
]
},
{
“___jsonclass”: “com.mop_demo.models.Category”,
“children”: [],
“created”: “1465214991000”,
“name”: “Trusted Wireless 2.0 I/O”,
“___class”: “com.mop_demo.models.Category”,
“ownerId”: null,
“updated”: null,
“objectId”: “75C2970D-2E76-67FA-FF46-D7124501EE00”,
“pcck”: “P-26-03-05”,
dates”: [
“1465214991000”
]
},
{
“___jsonclass”: “com.mop_demo.models.Category”,
“children”: [
{
“___objectref”: 3
},
{
“___objectref”: 5
},
{
“___objectref”: 7
},
{
“___jsonclass”: “com.mop_demo.models.Category”,
“children”: [],
“created”: “1465215076000”,
“name”: “DC charging cables”,
“___class”: “com.mop_demo.models.Category”,
“ownerId”: null,
“updated”: null,
“objectId”: “B8E5D92A-6323-D845-FF06-5F355678A800”,
“pcck”: “P-10-06-01”,
dates”: [
“1465215076000”
]
},
{
“___objectref”: 1
},
{
“___jsonclass”: “com.mop_demo.models.Category”,
“children”: [],
“created”: “1465215020000”,
“name”: “EtherNet/IP™”,
“___class”: “com.mop_demo.models.Category”,
“ownerId”: null,
“updated”: null,
“objectId”: “EE3E126F-2ED6-ACE2-FF58-F8D160943200”,
“pcck”: “P-04-07”,
dates”: [
“1465215020000”
]
}
],
“created”: “1465215085000”,
“___class”: “com.mop_demo.models.Category”,
“name”: “Power supplies with max functionality”,
“ownerId”: null,
“updated”: null,
“objectId”: “9A588714-C2ED-6AB6-FF2C-842994E90000”,
“pcck”: “P-22-03-06”,
dates”: [
“1465215085000”
]
},
{
“___objectref”: 9
},
{
“___objectref”: 1
},
{
“___objectref”: 11
}
],
“created”: “1465215089000”,
“___class”: “com.mop_demo.models.Category”,
“name”: “Conventional safety relays”,
“ownerId”: null,
“updated”: null,
“objectId”: “E5F2C6DA-3278-CA05-FF5B-6FE8EA341500”,
“pcck”: “P-05-01-01-03”,
dates”: [
“1465215089000”
]
},
{
“___objectref”: 7
}
]
[/spoiler]
In this case I’m having object with name “Category” that has ONE-TO-MANY relation to itself.

And for example in the first case(__originSubID) I understand how to interpret it but want to avoid this, i.e. to have full object description in json.

And for the second case(___objectref) I actually even don’t know how to deal with it.
Thanks.

Best Regards,
Oleg

Oleg, please, pay attention to our documentation about retrieving related objects.

Regards, Ilya

Ilya,
It is not obvious for me how this can help me solve my problem.

Hi Oleg,

Sorry, I probably misunderstood you a bit.

Oleg, these fields are not optimization but a necessity to resolve circular references
you may have.
According to the idea, you should not resolve these service fields by yourself.
It’s the job of our SDK.
That is why I wonder, how do you make requests, so you have to fight with this issue.
What Business Logic language do you use?
Do you make requests directly to the Backendless REST or use SDK methods?

Regards, Ilya

Hi Ilya,
I’m using Java for BL.
Yes, our iOS developers use Backendless REST instead of SDK, and they told me that moving from REST to SDK would not be a good solution for them.

Also I’ve noticed that these fields appears instead of real objects also for single level of objects.

In next example:
Comment has link to Product
Product has link to Category
Category has link to itself.

I’m loading …/Comment?pageSize=1&loadRelations=products.categories

In response some Categories also presented as __originSubID instead of real objects although no circular references should be loaded in this case.

[spoiler=“response example”]{
“offset”: 0,
“data”: [
{
“authorEmail”: “sdgf”,
“created”: 1468478749000,
“someDate”: null,
“___class”: “Comment”,
“someStuff”: null,
“message”: “I’m in!”,
“ownerId”: null,
“category”: null,
“updated”: null,
“objectId”: “E8D708CB-2DA7-B96B-FFC5-6C745C9ABB00”,
“products”: [
{
“productId”: “asdfasdf”,
“created”: 1469435636000,
“deeplinkUrl”: “asdf”,
“description”: null,
“ownerId”: null,
“title”: null,
“pcck”: null,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[“highlight”,“productId”,“created”,“deeplinkUrl”,“description”,“categories”,“ownerId”,“title”,“updated”,“objectId”,“pcck”,“thumbnailUrl”],“relatedObjects”:{“categories”:[“29F9AF77-56C3-8F46-FFD8-B92101BFE300”,“75C2970D-2E76-67FA-FF46-D7124501EE00”,“9A588714-C2ED-6AB6-FF2C-842994E90000”,“B8E5D92A-6323-D845-FF06-5F355678A800”,“E5F2C6DA-3278-CA05-FF5B-6FE8EA341500”,“EE3E126F-2ED6-ACE2-FF58-F8D160943200”]}}”,
“highlight”: null,
“___class”: “Product”,
“categories”: [
{
“children”: [],
“created”: 1465215069000,
“name”: “Device parametrisation”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “B0C41059-59EF-7AFB-FF52-4B62423E5100”,
“updated”: null,
“objectId”: “29F9AF77-56C3-8F46-FFD8-B92101BFE300”,
“pcck”: “P-19-02”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“children”,“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“children”: [],
“created”: 1465214991000,
“name”: “Trusted Wireless 2.0 I/O”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “30062F91-FD4E-197B-FF26-D439167CD900”,
“updated”: null,
“objectId”: “75C2970D-2E76-67FA-FF46-D7124501EE00”,
“pcck”: “P-26-03-05”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“children”,“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“children”: [],
“created”: 1465215085000,
“name”: “Power supplies with max functionality”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “7D8405F8-A7E7-BFDB-FFD9-CEE8BAAC1A00”,
“updated”: null,
“objectId”: “9A588714-C2ED-6AB6-FF2C-842994E90000”,
“pcck”: “P-22-03-06”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“children”,“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“children”: [],
“created”: 1465215076000,
“name”: “DC charging cables”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “351C0466-C6DF-6718-FF06-F76E6CF55100”,
“updated”: null,
“objectId”: “B8E5D92A-6323-D845-FF06-5F355678A800”,
“pcck”: “P-10-06-01”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“children”,“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“children”: [],
“created”: 1465215089000,
“name”: “Conventional safety relays”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “E9A49E65-AD6F-237C-FFBF-F7A2ECB93700”,
“updated”: null,
“objectId”: “E5F2C6DA-3278-CA05-FF5B-6FE8EA341500”,
“pcck”: “P-05-01-01-03”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“children”,“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“children”: [],
“created”: 1465215020000,
“name”: “EtherNet/IP™”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “9DDBEDBD-16BA-5069-FFB6-944700694F00”,
“updated”: null,
“objectId”: “EE3E126F-2ED6-ACE2-FF58-F8D160943200”,
“pcck”: “P-04-07”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“children”,“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
}
],
“updated”: null,
“objectId”: “31B75F7A-867A-82E5-FF3C-72F500BCC400”,
“thumbnailUrl”: null
},
{
“productId”: “fdghdfgh”,
“created”: 1471875324000,
“deeplinkUrl”: “sdfg”,
“description”: null,
“ownerId”: null,
“title”: null,
“pcck”: null,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[“highlight”,“productId”,“created”,“deeplinkUrl”,“description”,“categories”,“ownerId”,“title”,“updated”,“objectId”,“pcck”,“thumbnailUrl”],“relatedObjects”:{“categories”:[“29F9AF77-56C3-8F46-FFD8-B92101BFE300”,“75C2970D-2E76-67FA-FF46-D7124501EE00”,“9A588714-C2ED-6AB6-FF2C-842994E90000”,“B8E5D92A-6323-D845-FF06-5F355678A800”,“E5F2C6DA-3278-CA05-FF5B-6FE8EA341500”,“EE3E126F-2ED6-ACE2-FF58-F8D160943200”]}}”,
“highlight”: null,
“___class”: “Product”,
“categories”: [
{
“__originSubID”: “B0C41059-59EF-7AFB-FF52-4B62423E5100”
},
{
“__originSubID”: “30062F91-FD4E-197B-FF26-D439167CD900”
},
{
“__originSubID”: “7D8405F8-A7E7-BFDB-FFD9-CEE8BAAC1A00”
},
{
“__originSubID”: “351C0466-C6DF-6718-FF06-F76E6CF55100”
},
{
“__originSubID”: “E9A49E65-AD6F-237C-FFBF-F7A2ECB93700”
},
{
“__originSubID”: “9DDBEDBD-16BA-5069-FFB6-944700694F00”
}
],
“updated”: null,
“objectId”: “741BBD03-1B02-4AD3-FF90-3524F54F6000”,
“thumbnailUrl”: null
}
],
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[“authorEmail”,“created”,“someDate”,”___class",“someStuff”,“message”,“ownerId”,“category”,“updated”,“objectId”,“products”],“relatedObjects”:{“products”:[“31B75F7A-867A-82E5-FF3C-72F500BCC400”,“741BBD03-1B02-4AD3-FF90-3524F54F6000”]}}"
}
],
“nextPage”: “https://api.backendless.com/v1/data/Comment?pageSize=1&offset=1&loadRelations=products.categories”,
“totalObjects”: 2
}
[/spoiler]
And when I’m removing from Category link to itself I’m getting perfect response with no __originSubID:
[spoiler=“response”]{
“offset”: 0,
“data”: [
{
“authorEmail”: “sdgf”,
“created”: 1468478749000,
“someDate”: null,
“___class”: “Comment”,
“someStuff”: null,
“message”: “I’m in!”,
“ownerId”: null,
“category”: null,
“updated”: null,
“objectId”: “E8D708CB-2DA7-B96B-FFC5-6C745C9ABB00”,
“products”: [
{
“productId”: “asdfasdf”,
“created”: 1469435636000,
“deeplinkUrl”: “asdf”,
“description”: null,
“ownerId”: null,
“title”: null,
“pcck”: null,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[“highlight”,“productId”,“created”,“deeplinkUrl”,“description”,“categories”,“ownerId”,“title”,“updated”,“objectId”,“pcck”,“thumbnailUrl”],“relatedObjects”:{“categories”:[“29F9AF77-56C3-8F46-FFD8-B92101BFE300”,“75C2970D-2E76-67FA-FF46-D7124501EE00”,“9A588714-C2ED-6AB6-FF2C-842994E90000”,“B8E5D92A-6323-D845-FF06-5F355678A800”,“E5F2C6DA-3278-CA05-FF5B-6FE8EA341500”,“EE3E126F-2ED6-ACE2-FF58-F8D160943200”]}}”,
“highlight”: null,
“___class”: “Product”,
“categories”: [
{
“created”: 1465215069000,
“name”: “Device parametrisation”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “BE206F8F-5167-EA33-FFB9-933D846BDF00”,
“updated”: null,
“objectId”: “29F9AF77-56C3-8F46-FFD8-B92101BFE300”,
“pcck”: “P-19-02”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“created”: 1465214991000,
“name”: “Trusted Wireless 2.0 I/O”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “D66F3737-A484-C57A-FFE5-DC4EEDD80A00”,
“updated”: null,
“objectId”: “75C2970D-2E76-67FA-FF46-D7124501EE00”,
“pcck”: “P-26-03-05”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“created”: 1465215085000,
“name”: “Power supplies with max functionality”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “75809FF0-9138-8E9A-FFA0-067C036A2C00”,
“updated”: null,
“objectId”: “9A588714-C2ED-6AB6-FF2C-842994E90000”,
“pcck”: “P-22-03-06”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“created”: 1465215076000,
“name”: “DC charging cables”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “F722D497-6E25-D65F-FFE8-11AE59112300”,
“updated”: null,
“objectId”: “B8E5D92A-6323-D845-FF06-5F355678A800”,
“pcck”: “P-10-06-01”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“created”: 1465215089000,
“name”: “Conventional safety relays”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “6A9C7DCA-3456-8991-FFA3-B14FC6147900”,
“updated”: null,
“objectId”: “E5F2C6DA-3278-CA05-FF5B-6FE8EA341500”,
“pcck”: “P-05-01-01-03”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“created”: 1465215020000,
“name”: “EtherNet/IP™”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “1009AE6E-022F-ED5E-FF02-EAE4E5B15900”,
“updated”: null,
“objectId”: “EE3E126F-2ED6-ACE2-FF58-F8D160943200”,
“pcck”: “P-04-07”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
}
],
“updated”: null,
“objectId”: “31B75F7A-867A-82E5-FF3C-72F500BCC400”,
“thumbnailUrl”: null
},
{
“productId”: “fdghdfgh”,
“created”: 1471875324000,
“deeplinkUrl”: “sdfg”,
“description”: null,
“ownerId”: null,
“title”: null,
“pcck”: null,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[“highlight”,“productId”,“created”,“deeplinkUrl”,“description”,“categories”,“ownerId”,“title”,“updated”,“objectId”,“pcck”,“thumbnailUrl”],“relatedObjects”:{“categories”:[“29F9AF77-56C3-8F46-FFD8-B92101BFE300”,“75C2970D-2E76-67FA-FF46-D7124501EE00”,“9A588714-C2ED-6AB6-FF2C-842994E90000”,“B8E5D92A-6323-D845-FF06-5F355678A800”,“E5F2C6DA-3278-CA05-FF5B-6FE8EA341500”,“EE3E126F-2ED6-ACE2-FF58-F8D160943200”]}}”,
“highlight”: null,
“___class”: “Product”,
“categories”: [
{
“created”: 1465215069000,
“name”: “Device parametrisation”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “BE206F8F-5167-EA33-FFB9-933D846BDF00”,
“updated”: null,
“objectId”: “29F9AF77-56C3-8F46-FFD8-B92101BFE300”,
“pcck”: “P-19-02”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“created”: 1465214991000,
“name”: “Trusted Wireless 2.0 I/O”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “D66F3737-A484-C57A-FFE5-DC4EEDD80A00”,
“updated”: null,
“objectId”: “75C2970D-2E76-67FA-FF46-D7124501EE00”,
“pcck”: “P-26-03-05”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“created”: 1465215085000,
“name”: “Power supplies with max functionality”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “75809FF0-9138-8E9A-FFA0-067C036A2C00”,
“updated”: null,
“objectId”: “9A588714-C2ED-6AB6-FF2C-842994E90000”,
“pcck”: “P-22-03-06”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“created”: 1465215076000,
“name”: “DC charging cables”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “F722D497-6E25-D65F-FFE8-11AE59112300”,
“updated”: null,
“objectId”: “B8E5D92A-6323-D845-FF06-5F355678A800”,
“pcck”: “P-10-06-01”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“created”: 1465215089000,
“name”: “Conventional safety relays”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “6A9C7DCA-3456-8991-FFA3-B14FC6147900”,
“updated”: null,
“objectId”: “E5F2C6DA-3278-CA05-FF5B-6FE8EA341500”,
“pcck”: “P-05-01-01-03”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
},
{
“created”: 1465215020000,
“name”: “EtherNet/IP™”,
“___class”: “Category”,
“ownerId”: null,
“__subID”: “1009AE6E-022F-ED5E-FF02-EAE4E5B15900”,
“updated”: null,
“objectId”: “EE3E126F-2ED6-ACE2-FF58-F8D160943200”,
“pcck”: “P-04-07”,
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[”__updated__meta",“created”,“name”,"___class",“ownerId”,“updated”,“objectId”,“pcck”],“relatedObjects”:{}}"
}
],
“updated”: null,
“objectId”: “741BBD03-1B02-4AD3-FF90-3524F54F6000”,
“thumbnailUrl”: null
}
],
“__meta”: “{“relationRemovalIds”:{},“selectedProperties”:[“authorEmail”,“created”,“someDate”,”___class",“someStuff”,“message”,“ownerId”,“category”,“updated”,“objectId”,“products”],“relatedObjects”:{“products”:[“31B75F7A-867A-82E5-FF3C-72F500BCC400”,“741BBD03-1B02-4AD3-FF90-3524F54F6000”]}}"
}
],
“nextPage”: “https://api.backendless.com/v1/data/Comment?pageSize=1&offset=1&loadRelations=products.categories”,
“totalObjects”: 2
}
[/spoiler]

So the only way to deal with it without using sdk is to process it by hands?

Best Regards, Oleg

Oleg, could you clear the situation, please.
Is the problem on the iOS client side or on the server side in your custom Business Logic.
If it’s the second case, you should use Backendless SDK for Java/Android on the server side to retrieve relative objects.
It should resolve all object references in the response and you don’t have to process them by hands.
Your custom Business logic doesn’t depend on how your client makes request - using REST or SDK and vice versa

Regards Ilya

The problem is on iOS client side when it uses REST API of Backendless Data API or Custom Service API.

In first case it gets “__originSubID” instead of full objects, in second case - “__objectRef/ __arrayRef” instead of full objects.

Can you tell an algorithm of how to match objects with “__objectRef/ __arrayRef” ?

Thanks.

why you do not use ios sdk? so you will work with objects, and you will not parse any json

Hi Oleg,

Really sorry, but these fields haven’t been documented yet and I can’t provide you the proper description of how this fields should be processed.
I’ve created the ticket to cover it by documentation (BKNDLSS-13108).
Please, try to use our SDK instead.

Regards, Ilya

Hi,

My name is Eugene, I’m working with Oleg on the same issue.
To not use SDK was strategic and architectural decision taken with assumption that backendless provides REST apis (as it is specified on the web site). Currently we are using RESTKit to persist backendless objects into CoreData. We have no capacity to switch to SDK now and if there is a way to deal with references - it would be very helpful to know it.

Regards, Eugene.

Ok. if you use Data Service, you can see next objects in response


"categories": [
{
"__originSubID": "B0C41059-59EF-7AFB-FF52-4B62423E5100"
}

it’s mean that there is object with this id:


"categories": [
{
"children": [],
"created": 1465215069000,
"name": "Device parametrisation",
"___class": "Category",
"ownerId": null,
"__subID": "B0C41059-59EF-7AFB-FF52-4B62423E5100",
"updated": null,
"objectId": "29F9AF77-56C3-8F46-FFD8-B92101BFE300",
"pcck": "P-19-02",
"__meta": "{\"relationRemovalIds\":{},\"selectedProperties\":[\"__updated__meta\",\"children\",\"created\",\"name\",\"___class\",\"ownerId\",\"updated\",\"objectId\",\"pcck\"],\"relatedObjects\":{}}"
}

so in this case, you should use this object instead of reference. it was made to prevent cycle reference

Hi Sergey

Thanks for the answer. It will partly fix our issue, but we also use Custom API. And there are objectRef and arrayRef . Could you please explain how we can deal with it?

If there is an __arrayRef in Cloud Code JS then how do I convert it to a proper object in JS? Is there a utility function that can do this?

Hi Jonathan,

Do you use the “raw” REST API in your cloud code or the Backendless SDK for JS?

Regards,
Mark

This is with the Business Logic JS service that is accepting data from iOS Backendless SDK. The data coming from the SDK is a Backendless table object in JSON form.

Please let me know if I’m doing something wrong here. When I pass an object to the business logic service, it shows these arrayRef pointers. I know it has to do with possible circular references but how do I decrypt this so I can process the object accordingly?

@mark-piller
Do you have any feedback on how to avoid this? I’m sending an object from iOS to Business Logic JS