0

Due to limitations of an embedded scripting language that I am using (Linden Scripting Language, LSL for short), I must rely on the REST api for Parse.com, and unfortunately the REST api documentation is unclear or incomplete on some subjects.

This is (roughly speaking) what my objects will look like:

{
    "objectId": string_val,
    "createdAt": date_val,
    "updatedAt": date_val,
    "OwnerKey": string_val,
    "DocID": string_val,
    "Data": []
}

What I need to do are two things:

  1. I need to be able to append string values to the Data array, if they do not already exist. "add-unique" is the name of the operation, but I have no idea how to use it from the REST api.
  2. I need to be able to load the array in chunks. For example, first load elements 0 through 31, then elements 32 through 63, and so on. This is due to limitations on both memory usage (64kb total) and a limit on the size of http response bodies (16kb), and I expect the total list size to become quite large.

I know not everyone is proficient with LSL (and be thankful that you are not!), so answers do not necessarily need to be in LSL. I understand Python code, so answers can be in that. I also understand the CURL examples that parse.com uses in their REST documentation, so answers can also be in that.

Zauberin Stardreamer
  • 1,284
  • 1
  • 13
  • 22

1 Answers1

1
  1. This is directly addressed in the REST API Guide under "Arrays" and was the first result when I searched for "AddUnique" over https://parse.com/docs/rest.

  2. Objects are limited to 128 KB so storing a big array of objects like this is not recommended. Can you use a Relation field instead as recommended in the Relations guide?

Héctor Ramos
  • 9,239
  • 6
  • 36
  • 39
  • 2. I did the math and the problems of memory usage are not as great as I believed. 128k should be enough to store roughly 3000 UUID's, assuming that strings are stored as UTF-8. If there's a way to get it to store UUID's in binary form as a 128-bit integer, capacity is slightly more than double. Anyways, I'll look at relations to see if they would be useful. – Zauberin Stardreamer Sep 12 '15 at 13:04