Skip to content
Richard Ng edited this page Mar 18, 2020 · 5 revisions

All Payments API endpoints require authorisation to enable authorisation follow these steps

  1. Call the user Login endpoint
  2. retrieve the token from the response of the login
  3. add "Bearer <jwt token>" to the Authorisation Header field
  4. Send the Payment API request

/api/Payments/User/userId

Method: GET

Description: This method is used to get all the Payments that are associated with a user that is currently logged in

Response

example request URL: https://localhost:5001/api/Payments/User/1

STATUS CODE: 200

{
    "id": 1,
    "amount": 175,
    "fixed": false,
    "startDate": "2020-03-07T00:00:00",
    "endDate": "2020-06-07T00:00:00",
    "paymentType": 1,
    "frequency": 3,
    "description": "electricity"
  },

/api/Payments/Flat

Method: GET

Description: This method is used to get all the Payments that are associated with a flat

Response

example request URL: https://localhost:5001/api/Payments/Flat/1

STATUS CODE: 200 OK

{
    "id": 1,
    "amount": 175,
    "fixed": false,
    "startDate": "2020-03-07T00:00:00",
    "endDate": "2020-06-07T00:00:00",
    "paymentType": 1,
    "frequency": 3,
    "description": "electricity"
  }

/api/Payments/Flat

Method: POST

Description: This method is used to add a new payment to a flat and add users to that payment

Body Input

Parameters Format
Payment Payment Object

Header Parameters

Parameters Format
userIds List of Ids

Request Body example

{
  "id": 0,
  "amount": 0,
  "fixed": true,
  "startDate": "2020-03-16T04:25:50.783Z",
  "endDate": "2020-03-16T04:25:50.783Z",
  "paymentType": 0,
  "frequency": 0,
  "description": "string"
}

Response

example request URL: https://localhost:5001/api/Payments/Flat/1

STATUS CODE: 200 OK

{
  "id": 0,
  "amount": 0,
  "fixed": true,
  "startDate": "2020-03-16T04:25:50.783Z",
  "endDate": "2020-03-16T04:25:50.783Z",
  "paymentType": 0,
  "frequency": 0,
  "description": "string"
 },

/api/Payments/Flat/{flatId}

Method: DELETE

Description: This method is used to delete a payment from a flat

Input

Path Parameters

Parameters Format
flatId Integer

Query Parameters

Parameters Format
paymentId Integer

Response

example request URL: https://localhost:5001/api/Payments/Flat/1?paymentId=2

STATUS CODE: 200 OK

{
    "id": 1,
    "amount": 175,
    "fixed": false,
    "startDate": "2020-03-07T00:00:00",
    "endDate": "2020-06-07T00:00:00",
    "paymentType": 1,
    "frequency": 3,
    "description": "electricity"
  },

/api/Payments/User/{paymentId}

Method: PUT

Description: This method is used to add a user to an existing payment

Input

Path Parameters

Parameters Format
paymentId Integer

Query Parameters

Parameters Format
userId Integer

Response

example request URL: https://localhost:5001/api/Payments/User/5?userID=1

STATUS CODE: 204 NO CONTENT

/api/Payments/User/{paymentId}

Method: DELETE

Description: This method is used to delete a user from a payment

Input

Path Parameters

Parameters Format
paymentId Integer

Query Parameters

Parameters Format
userId Integer

Response

example request URL: https://localhost:5001/api/Payments/User/4?userId=1

STATUS CODE: 204 NO CONTENT

/api/Payments/{id}

Method: PUT

Description: This method updates a specific payment

Input

Path Parameters

Parameters Format
id Integer

Request Body Example

{
  "id": 0,
  "amount": 0,
  "fixed": true,
  "startDate": "2020-03-16T07:35:31.131Z",
  "endDate": "2020-03-16T07:35:31.131Z",
  "paymentType": 0,
  "frequency": 0,
  "description": "string"
}

Response

example request URL: https://localhost:5001/api/Payments/5

STATUS CODE: 204 NO CONTENT

Clone this wiki locally