API should return id's of updated objects

Everything is going great using the Coda API. I have developed an object structure that allows me to update all elements of a document (within the limitations of the API) without having to GET from the server again. However, there is something missing: Whenever I do an upsert it would be very useful to know at least the id of the row updated or inserted. Currently I’m able to maintain a useful copy of the doc in the app in memory except for when a row is upserted. Is there any plan to request response to the client the affected rowId and/or elements?

Hi Joey, thanks for the suggestion. Since writes in the API are currently asynchronous, the upsert endpoint currently doesn’t return anything more than a requestId that you can use with getMutationStatus to determine when the write has succeeded.

I’m imagining that you’re upserting rows with a keyColumns (upsert keys) that’s different from the display column, and you’d like to know the effective row ID. There are currently two solutions to this:

  1. Since rows can also be referred to by their display column, if you’re upserting using the same value as the display column, you can just use that instead of the row ID to refer to the row. Many API operations accept the row name that way, and you can also look into the useColumnNames option available on some operations
  2. Alternatively, you can wait until the write completes (by polling using getMutationStatus), and then call listRows with the query param to look up that row and determine its ID

Again, due to the async nature of writes, I’m not sure that we can safely return the row IDs of upserted rows in this same API call, since the effective row might be different by the time that specific write is processed (i.e., if there were other payloads queued up at the time of the request).