splitwise / api-docs

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

create_expense for a group #25

Closed goleary closed 4 years ago

goleary commented 4 years ago

I'd like to use the create_expense endpoint to submit an expense for a group and have it split amongst all members. Does the splitwise API provide this functionality?

I'm really hoping I don't have to pull a list of all group members and then do all of the math on my end and then submit the expense in a separate request.

When I submit an expense with group_id populated, but no user I get an error...

jas14 commented 4 years ago

If you provide the ID of a group of which the requesting user is a member via the top-level group_id parameter, and a top-level param split_equally (set to true), we'll split equally between all members of that group.

EDIT: When using the split_equally flag, you cannot provide individual users, only a group.

goleary commented 4 years ago

I see. This is exactly what I was looking for, thanks!

That said, due to the lack of documentation perhaps this issue should remain open until this information is available self serve?

I'd be happy to help contribute to the docs, but considering the lack of any details in the (new) expense section, I'm a bit hesitant. It seems like someone on your end should get it started.

:)

ghost commented 4 years ago

Thanks for the notes here. Helped me successfully implement create_expense

jas14 commented 4 years ago

The docs have been updated: https://dev.splitwise.com/#create_expense

goleary commented 4 years ago

unreal, thanks Joe! They look great.

jas14 commented 4 years ago

Thanks go to @mgod for #32! 🙂