Is there any way to re-order items in a checklist through the API

36 views
Skip to first unread message

Jan Drewniak

unread,
Aug 14, 2013, 9:39:06 AM8/14/13
to spring...@googlegroups.com
any ideas? I'd like to make a shopping list app with springpad and this would be a nice feature to have. 

James Wald

unread,
Aug 17, 2013, 1:46:48 AM8/17/13
to spring...@googlegroups.com
Hey Jan,

I'm one of the Android developers here at Springpad.

The API does support reordering.  A checklist has the property items which is an ordered list of strings which represent the uuids of it's checklist items.  The order of this list determines the order of the items as displayed by the various Springpad clients.

The API provides the commands endpoint for modifying user data.  The POST body must be a list of commands, where each command is a map  .The simplest way to reorder a list is to POST a move-behind command to this endpoint.  move-behind is essentially a convenience that could also be implemented using a remove and add operation.  Here's an example POST body containing a single move-behind command and a description of each property shown:

[
  {
    "cmd": "move-behind",
    "property": "items",
    "this": "/UUID(37353db4-b28c-41da-a75a-91c2842f53c5)/",
    "value": "/UUID(3730ec7c-d433-4c56-a227-47bff351e9f7)/",
    "item": "/UUID(3736985d-cfef-44b4-9eda-682d72ba798f)/"
  }
]

cmd The command.
property The checklist block items property.
this The uuid of the checklist block.
value The uuid of the checklist item that is being moved.
item The uuid of the checklist item that will appear just before the checklist item that is being moved.  This property does not exist when the checklist item is being moved to the first position.

That's it!  Please let me know if this answers your question.

Best,
James

Jan Drewniak

unread,
Sep 10, 2013, 2:16:56 PM9/10/13
to spring...@googlegroups.com
Hi there, 
thanks for the very thorough response. 
It works just as described :) 

cheers
Jan
Reply all
Reply to author
Forward
0 new messages