From 624b720f19177772bbd98f9825109aead7217832 Mon Sep 17 00:00:00 2001 From: Joe Stein Date: Mon, 22 Aug 2022 16:28:54 -0400 Subject: [PATCH 1/6] Fix invalid user ref in comment schema --- schemas/comment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/comment.yaml b/schemas/comment.yaml index 654574d..e8b7072 100644 --- a/schemas/comment.yaml +++ b/schemas/comment.yaml @@ -24,4 +24,4 @@ properties: format: date-time nullable: true user: - - $ref: ./comment_user.yaml + $ref: ./comment_user.yaml From 5b041df902cafc7249815c40fc98e6cafce4b738 Mon Sep 17 00:00:00 2001 From: Joe Stein Date: Mon, 22 Aug 2022 16:41:02 -0400 Subject: [PATCH 2/6] Fix parameter declarations --- paths/delete_comment.yaml | 2 +- paths/delete_expense.yaml | 11 +++++++---- paths/delete_friend.yaml | 14 +++++++------- paths/index.yaml | 2 +- paths/undelete_expense.yaml | 11 +++++++---- paths/update_expense.yaml | 11 +++++++---- 6 files changed, 30 insertions(+), 21 deletions(-) diff --git a/paths/delete_comment.yaml b/paths/delete_comment.yaml index 4ff2dd0..df7182a 100644 --- a/paths/delete_comment.yaml +++ b/paths/delete_comment.yaml @@ -1,6 +1,6 @@ --- post: - params: + parameters: - in: path name: id schema: diff --git a/paths/delete_expense.yaml b/paths/delete_expense.yaml index 3965fb3..5e9ffc8 100644 --- a/paths/delete_expense.yaml +++ b/paths/delete_expense.yaml @@ -1,14 +1,17 @@ --- -params: -- in: query - name: id - description: ID of the expense to delete post: tags: - expenses summary: Delete an expense description: "**Note**: 200 OK does not indicate a successful response. The operation was successful only if `success` is true.\n" + parameters: + - in: path + name: id + description: ID of the expense to delete + schema: + type: integer + required: true responses: '200': content: diff --git a/paths/delete_friend.yaml b/paths/delete_friend.yaml index 62beeae..9b6cb09 100644 --- a/paths/delete_friend.yaml +++ b/paths/delete_friend.yaml @@ -1,11 +1,4 @@ --- -parameters: -- in: path - name: id - description: User ID of the friend - schema: - type: integer - required: true post: tags: - friends @@ -14,6 +7,13 @@ post: Given a friend ID, break off the friendship between the current user and the specified user. **Note**: 200 OK does not indicate a successful response. You must check the `success` value of the response. + parameters: + - in: path + name: id + description: User ID of the friend + schema: + type: integer + required: true responses: '200': description: OK diff --git a/paths/index.yaml b/paths/index.yaml index bd3e2f2..f773938 100644 --- a/paths/index.yaml +++ b/paths/index.yaml @@ -47,7 +47,7 @@ $ref: ./get_comments.yaml /create_comment: $ref: ./create_comment.yaml -/delete_comment: +/delete_comment/{id}: $ref: ./delete_comment.yaml /get_notifications: $ref: ./get_notifications.yaml diff --git a/paths/undelete_expense.yaml b/paths/undelete_expense.yaml index 08cb8d5..d685ba4 100644 --- a/paths/undelete_expense.yaml +++ b/paths/undelete_expense.yaml @@ -1,14 +1,17 @@ --- -params: -- in: query - name: id - description: ID of the expense to restore post: tags: - expenses summary: Restore an expense description: "**Note**: 200 OK does not indicate a successful response. The operation was successful only if `success` is true.\n" + parameters: + - in: path + name: id + description: ID of the expense to restore + schema: + type: integer + required: true responses: '200': content: diff --git a/paths/update_expense.yaml b/paths/update_expense.yaml index b74c15e..629b82a 100644 --- a/paths/update_expense.yaml +++ b/paths/update_expense.yaml @@ -1,8 +1,4 @@ --- -params: -- in: query - name: id - description: ID of the expense to update post: tags: - expenses @@ -13,6 +9,13 @@ post: shares for the expense will be overwritten with the provided values. **Note**: 200 OK does not indicate a successful response. The operation was successful only if `errors` is empty. + parameters: + - in: path + name: id + description: ID of the expense to update + schema: + type: integer + required: true requestBody: required: true content: From 547bed0b6b161c9920a9cf677713390397704b07 Mon Sep 17 00:00:00 2001 From: Joe Stein Date: Mon, 22 Aug 2022 16:43:39 -0400 Subject: [PATCH 3/6] Fix examples --- paths/add_user_to_group.yaml | 2 +- paths/create_friends.yaml | 10 +++++----- paths/remove_user_from_group.yaml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/paths/add_user_to_group.yaml b/paths/add_user_to_group.yaml index acf6bdd..a154a89 100644 --- a/paths/add_user_to_group.yaml +++ b/paths/add_user_to_group.yaml @@ -64,7 +64,7 @@ post: value: success: true user: {} - errors: [] + errors: {} Failure: value: success: false diff --git a/paths/create_friends.yaml b/paths/create_friends.yaml index f878107..b2d42fd 100644 --- a/paths/create_friends.yaml +++ b/paths/create_friends.yaml @@ -58,10 +58,10 @@ post: example: base: - Please supply a name for this user - example: - users: [] - errors: - base: - - That user cannot be a member of this group + example: + users: [] + errors: + base: + - That user cannot be a member of this group '401': "$ref": "../responses/unauthorized.yaml" diff --git a/paths/remove_user_from_group.yaml b/paths/remove_user_from_group.yaml index 42ae787..73ad454 100644 --- a/paths/remove_user_from_group.yaml +++ b/paths/remove_user_from_group.yaml @@ -41,7 +41,7 @@ post: Success: value: success: true - errors: [] + errors: {} Failure: value: success: false From 1cc7859dabb50a27a755bfb9db345b9c74b5d2ba Mon Sep 17 00:00:00 2001 From: Joe Stein Date: Mon, 22 Aug 2022 16:44:36 -0400 Subject: [PATCH 4/6] Fix missing response descriptions --- paths/delete_expense.yaml | 1 + paths/undelete_expense.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/paths/delete_expense.yaml b/paths/delete_expense.yaml index 5e9ffc8..de1ad99 100644 --- a/paths/delete_expense.yaml +++ b/paths/delete_expense.yaml @@ -14,6 +14,7 @@ post: required: true responses: '200': + description: OK content: application/json: schema: diff --git a/paths/undelete_expense.yaml b/paths/undelete_expense.yaml index d685ba4..d39226b 100644 --- a/paths/undelete_expense.yaml +++ b/paths/undelete_expense.yaml @@ -14,6 +14,7 @@ post: required: true responses: '200': + description: OK content: application/json: schema: From 653ced009889082c456f540820d6118e07067aae Mon Sep 17 00:00:00 2001 From: Joe Stein Date: Mon, 22 Aug 2022 16:46:46 -0400 Subject: [PATCH 5/6] Fix bad `required` directives --- docs/index.html | 41 ++++++++++++++++++++++----------------- paths/delete_expense.yaml | 3 ++- paths/parse_sentence.yaml | 3 --- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/docs/index.html b/docs/index.html index c493799..73abb7f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2163,7 +2163,7 @@ -

Terms of Use

Overview

Splitwise provides this Self-Serve API to facilitate integrations with third-party applications, as well as open-up functionality for hobbyists and power users to programmatically interact with their own Splitwise account and build plugins or other tools.

-

If you’re interested in integrating your commercial application with Splitwise, we strongly encourage you to contact developers@splitwise.com so our development team can help discuss your use case, provide private APIs and Enterprise support, and offer an appropriate commercial license for the integration. The Self-Serve API documented here may be suitable for internal prototyping and other exploratory work.

-

If you are developing a non-commercial plugin application or personal project, we recommend you make use of the Self-Serve API documented here under the API Terms Of Use. Please be aware that our Self-Serve API has conservative rate and access limits, which are subject to change at any time and not well suited to commercial projects. If this is a problem for your use case, please contact us at developers@splitwise.com to discuss your needs.

+

If you’re interested in integrating your commercial application with Splitwise, we strongly encourage you to contact developers@splitwise.com so our development team can help discuss your use case, provide private APIs and Enterprise support, and offer an appropriate commercial license for the integration. The Self-Serve API documented here may be suitable for internal prototyping and other exploratory work.

+

If you are developing a non-commercial plugin application or personal project, we recommend you make use of the Self-Serve API documented here under the API Terms Of Use. Please be aware that our Self-Serve API has conservative rate and access limits, which are subject to change at any time and not well suited to commercial projects. If this is a problem for your use case, please contact us at developers@splitwise.com to discuss your needs.

All Self-Service API users are subject to the API Terms of Use below.

TERMS OF USE

These API Terms of Use describe your rights and responsibilities when accessing our publicly available Application Programming Interface (API) and related API documentation. Please review them carefully.

Splitwise may modify this Agreement at any time by posting a revised version on our website. The revised version will be effective at the time that it is posted.

@@ -2483,10 +2483,10 @@

Response samples

Content type
application/json
Example
{
  • "success": true
}

Add a user to a group

Note: 200 OK does not indicate a successful response. You must check the success value of the response.

Authorizations:
Request Body schema: application/json
One of
group_id
required
integer
user_id
required
integer

Responses

Request samples

Content type
application/json
Example
{
  • "group_id": 49012,
  • "user_id": 7999632
}

Response samples

Content type
application/json
Example
{
  • "success": true,
  • "user": { },
  • "errors": [ ]
}

Remove a user from a group

Remove a user from a group. Does not succeed if the user has a non-zero balance.

+

Request samples

Content type
application/json
Example
{
  • "group_id": 49012,
  • "user_id": 7999632
}

Response samples

Content type
application/json
Example
{
  • "success": true,
  • "user": { },
  • "errors": { }
}

Remove a user from a group

Remove a user from a group. Does not succeed if the user has a non-zero balance.

Note: 200 OK does not indicate a successful response. You must check the success value of the response.

Authorizations:
Request Body schema: application/json
group_id
required
integer
user_id
required
integer

Responses

Request samples

Content type
application/json
{
  • "group_id": 4012,
  • "user_id": 940142
}

Response samples

Content type
application/json
Example
{
  • "success": true,
  • "errors": [ ]
}

Friends

List current user's friends

Note: group objects only include group balances with that friend.

+

Request samples

Content type
application/json
{
  • "group_id": 4012,
  • "user_id": 940142
}

Response samples

Content type
application/json
Example
{
  • "success": true,
  • "errors": { }
}

Friends

List current user's friends

Note: group objects only include group balances with that friend.

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "friends": [
    ]
}

Get details about a friend

Authorizations:
path Parameters
id
required
integer

User ID of the friend

@@ -2516,13 +2516,13 @@

Response samples

Content type
application/json
{
  • "expense": {
    }
}

List the current user's expenses

Authorizations:
query Parameters
group_id
integer

If provided, only expenses in that group will be returned, and friend_id will be ignored.

+

Response samples

Content type
application/json
{
  • "expense": {
    }
}

List the current user's expenses

Authorizations:
query Parameters
group_id
integer

If provided, only expenses in that group will be returned, and friend_id will be ignored.

friend_id
integer

ID of another user. If provided, only expenses between the current and provided user will be returned.

dated_after
string <date-time>
dated_before
string <date-time>
updated_after
string <update-time>
updated_before
string <date-time>
limit
integer
Default: 20
offset
integer
Default: 0

Responses

Response samples

Content type
application/json
{
  • "expenses": [
    ]
}

Create an expense

Creates an expense. You may either split an expense equally (only with group_id provided), +

Response samples

Content type
application/json
{
  • "expenses": [
    ]
}

Create an expense

Creates an expense. You may either split an expense equally (only with group_id provided), or supply a list of shares.

When splitting equally, the authenticated user is assumed to be the payer.

When providing a list of shares, each share must include paid_share and owed_share, and must be identified by one of the following:

@@ -2541,11 +2541,12 @@
split_equally
required
boolean
Value: true

Responses

Request samples

Content type
application/json
Example
{
  • "cost": "25",
  • "description": "Grocery run",
  • "details": "string",
  • "date": "2012-05-02T13:00:00Z",
  • "repeat_interval": "never",
  • "currency_code": "USD",
  • "category_id": 15,
  • "group_id": 0,
  • "split_equally": true
}

Response samples

Content type
application/json
{
  • "expenses": [
    ],
  • "errors": { }
}

Update an expense

Updates an expense. Parameters are the same as in create_expense, but you only need to include parameters +

Request samples

Content type
application/json
Example
{
  • "cost": "25",
  • "description": "Grocery run",
  • "details": "string",
  • "date": "2012-05-02T13:00:00Z",
  • "repeat_interval": "never",
  • "currency_code": "USD",
  • "category_id": 15,
  • "group_id": 0,
  • "split_equally": true
}

Response samples

Content type
application/json
{
  • "expenses": [
    ],
  • "errors": { }
}

Update an expense

Updates an expense. Parameters are the same as in create_expense, but you only need to include parameters that are changing from the previous values. If any values is supplied for users__{index}__{property}, all shares for the expense will be overwritten with the provided values.

Note: 200 OK does not indicate a successful response. The operation was successful only if errors is empty.

-
Authorizations:
Request Body schema: application/json
cost
required
string

A string representation of a decimal value, limited to 2 decimal places

+
Authorizations:
path Parameters
id
required
integer

ID of the expense to update

+
Request Body schema: application/json
cost
required
string

A string representation of a decimal value, limited to 2 decimal places

description
required
string

A short description of the expense

details
string or null

Also known as "notes."

date
string <date-time>

The date and time the expense took place. May differ from created_at

@@ -2559,26 +2560,30 @@
users__{index}__{property}*
string

Responses

Request samples

Content type
application/json
{
  • "cost": "25",
  • "description": "Grocery run",
  • "details": "string",
  • "date": "2012-05-02T13:00:00Z",
  • "repeat_interval": "never",
  • "currency_code": "USD",
  • "category_id": 15,
  • "group_id": 0,
  • "users__0__user_id": 54123,
  • "users__0__paid_share": "25",
  • "users__0__owed_share": "13.55",
  • "users__1__first_name": "Neu",
  • "users__1__last_name": "Yewzer",
  • "users__1__email": "neuyewxyz@example.com",
  • "users__1__paid_share": "0",
  • "users__1__owed_share": "11.45",
  • "users__{index}__{property}1": "string",
  • "users__{index}__{property}2": "string"
}

Response samples

Content type
application/json
{
  • "expenses": [
    ],
  • "errors": { }
}

Delete an expense

Note: 200 OK does not indicate a successful response. The operation was successful only if success is true.

-
Authorizations:

Responses

Request samples

Content type
application/json
{
  • "cost": "25",
  • "description": "Grocery run",
  • "details": "string",
  • "date": "2012-05-02T13:00:00Z",
  • "repeat_interval": "never",
  • "currency_code": "USD",
  • "category_id": 15,
  • "group_id": 0,
  • "users__0__user_id": 54123,
  • "users__0__paid_share": "25",
  • "users__0__owed_share": "13.55",
  • "users__1__first_name": "Neu",
  • "users__1__last_name": "Yewzer",
  • "users__1__email": "neuyewxyz@example.com",
  • "users__1__paid_share": "0",
  • "users__1__owed_share": "11.45",
  • "users__{index}__{property}1": "string",
  • "users__{index}__{property}2": "string"
}

Response samples

Content type
application/json
{
  • "expenses": [
    ],
  • "errors": { }
}

Delete an expense

Note: 200 OK does not indicate a successful response. The operation was successful only if success is true.

+
Authorizations:
path Parameters
id
required
integer

ID of the expense to delete

+

Responses

Response samples

Content type
application/json
Example
{
  • "success": true
}

Restore an expense

Note: 200 OK does not indicate a successful response. The operation was successful only if success is true.

-
Authorizations:

Responses

Authorizations:
path Parameters
id
required
integer

ID of the expense to restore

+

Responses

Response samples

Content type
application/json
{
  • "success": true
}

Comments

Get expense comments

Authorizations:
query Parameters
expense_id
required
integer
Example: expense_id=4193

Responses

Response samples

Content type
application/json
{
  • "comments": [
    ]
}

Create a comment

Authorizations:
Request Body schema: application/json
expense_id
integer
content
string

Responses

Response samples

Content type
application/json
{
  • "comments": [
    ]
}

Create a comment

Authorizations:
Request Body schema: application/json
expense_id
integer
content
string

Responses

Request samples

Content type
application/json
{
  • "expense_id": 5123,
  • "content": "Does this include the delivery fee?"
}

Response samples

Content type
application/json
{
  • "comment": {
    }
}

Delete a comment

Deletes a comment. Returns the deleted comment.

-
Authorizations:

Responses

Request samples

Content type
application/json
{
  • "expense_id": 5123,
  • "content": "Does this include the delivery fee?"
}

Response samples

Content type
application/json
{
  • "comment": {
    }
}

Delete a comment

Deletes a comment. Returns the deleted comment.

+
Authorizations:
path Parameters
id
required
integer

Responses

Response samples

Content type
application/json
{
  • "comment": {
    }
}

Notifications

Get notifications

Return a list of recent activity on the users account with the most recent items first. +

Response samples

Content type
application/json
{
  • "comment": {
    }
}

Notifications

Get notifications

Return a list of recent activity on the users account with the most recent items first. content will be suitable for display in HTML and uses only the <strong>, <strike>, <small>, <br> and <font color="#FFEE44"> tags.

The type value indicates what the notification is about. Notification types may be added in the future @@ -2676,9 +2681,9 @@

Authorizations:
Request Body schema: application/json
One of
input
required
string

A natural language sentence describing an expense.

autosave
boolean
Default: false

If true, the resulting expense will be saved if valid.

Responses

Request samples

Content type
application/json
Example
{
  • "input": "I owe Ada 5 bucks",
  • "autosave": false
}

Response samples

Content type
application/json
{
  • "expense": {
    },
  • "valid": true,
  • "confidence": 0.5,
  • "error": "string"
}
+

Request samples

Content type
application/json
Example
{
  • "input": "I owe Ada 5 bucks",
  • "autosave": false
}

Response samples

Content type
application/json
{
  • "expense": {
    },
  • "valid": true,
  • "confidence": 0.5,
  • "error": "string"
}