freecals
All topics

Corrections and deletes

How to change what the journal holds without leaving duplicates.

Replace by id

  • To change an entry, call log_food with its id and the full new state.
  • Keep itemId on the items that stay. Items without itemId are new. Stored items missing from the list are removed.
  • An omitted time is cleared. date and timeZone default to the stored ones.
  • save_food and log_weight replace by id the same way.
  • Use a new requestId for a correction. Reuse a requestId only to retry the same call.

Common corrections

  • "Actually it was a medium latte" replaces that one item and keeps the other items with their itemId.
  • "Those are not nuggets, that is a McChicken" replaces the wrong item.
  • "No, it was all yesterday" moves the entries you just logged. Replace each one by id with the new date.
  • "Did you log the chips?" asks you to check. Read the journal and answer from what it returns.

Deletes

  • To remove one item, send the entry with the remaining items.
  • To remove a whole entry, call delete with its entry_… id.
  • "Remove the jerky, also add 20g soy sauce" is one delete and one log_food.