splitwise / api-docs

API documentation for the Splitwise API.
http://dev.splitwise.com
29 stars 16 forks source link

what does creation_method parameter of create_expense endpoint do? #24

Closed goleary closed 4 years ago

goleary commented 4 years ago

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

and have the splitwise backend figure out who owes what?

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

jas14 commented 4 years ago

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!

goleary commented 4 years ago

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)

goleary commented 4 years ago

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

A couple of questions:

jas14 commented 4 years ago
  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"
goleary commented 4 years ago

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 ;)