johnRedden / TextbookProject

Textbook project start.
0 stars 0 forks source link

API: Calls to wait for consistency. #19

Closed FelixVicis closed 8 years ago

FelixVicis commented 8 years ago

Our make API leaves some to be desired.

Change, or make new calls, to Writer api's to only return success when items are ready to be called out of datastore.

FelixVicis commented 8 years ago

Results

So, overall, it was actually a very simple fix.

Datastore.Put actually returns the key that an object was placed in. So, in our instance. All I needed to do was get the returned location and send that out.

Success, in a make command now looks like this:

{
  "result": "success",
  "reason": "",
  "code": 0,
  "object": {
    "Title": "New/Updated Object Title",
    "ID": "New/Updated Object ID"
  }
}

When you create or update an object with this call. You can access the json.object.Title and json.object.ID for the results of the call.