splitwise/api-docs

what does creation_method parameter of create_expense endpoint do?

goleary opened this issue · 5 comments

I understand how to create expenses where I do all of the math on my end (i.e. submit an "array" of involved users with what each spent and what they owe).

I've noticed in the documentation there is an optional parameter:

creation_method: iou, quickadd, payment, or split

Is there any way to use this so that I don't have to do the splitting math on my end. For instance, submit

  • array of involved id
  • cost
  • description
  • split method: "split"

and have the splitwise backend figure out who owes what?

If not, what is the point of this optional parameter?

jas14 commented

Unfortunately, that parameter is mislabeled, and is actually not useful. We're sorry about that!

Have you looked at the parse_expense endpoint? Although you do have to provide a natural language sentence, it'll do the math for you.

Hope this, along with my answer to #25, helps!

I have not tried the parse_sentence endpoint, but I'll take a look.

Thanks for the quick replies, you've set me on the right track.

(also leaving this one open for the same reason listed in #25)

@jas14
I did a little poking around with the parse_sentence endpoint.

A couple of questions:

jas14 commented
  1. friend_id indicates the user ID of the friend; friendship_id is the ID of the friendship object that encodes the friendship (has the ID of each user).
  2. Unfortunately, that's correct - it can only be used for a single group or user.
  3. "IOU" is not in our model, but "owe", "owes", and "owed" will work. Here are some examples of sentences that will parse:
  • "A owes B five dollars"
  • "A paid C five cents"
  • "B lent A 5 bucks"

Sweet thanks for all of your help Joe!

I'll think about how I can leverage this in my app.

Looks like you've got some great content for the documentation ;)