Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

Introduction

The /loansendpoint allows you to perform Create, Read, Update, and Delete queries for a Loan Record by providing relevant information. This endpoint is accessible through either a GET, POST, PATCH, or DELETE request and requires the use of a valid <api_key> for authentication purposes. TaskSuite will provide the appropriate key for Giggle Finance.

Authentication

To access this endpoint, you need to include the <api_key> in the header payload. The <api_key> serves as an authentication mechanism to ensure only authorized users can manipulate Loan Records.


Create a Loan Record

End Point URL

https://www.giggle.tasksuite.com/webhook/json/v1/loans

Request Method

POST

Request Body

The request body must be a JSON payload with the following fields

Field

Sub-Field

Description

Data Type/Format

Required

1

loanAmount

Total payback amount of the loan.

Float

  • Only to the hundredths place.

  • (e.g. 2000.22)

X

2

loanTerm

Term of the loan in number of weeks

Integer

X

3

contractDate

Date the contract was signed.

String (YYYY-MM-DD)

X

4

firstPaymentDate

First payment date of the loan.

String (YYYY-MM-DD)

X

5

loanClass

Class of the Loan

String

X

6

loanType

Type of loan, (e.g “Instalment”)

String

X

7

oFee

Origination fee of the loan.

Float

X

8

disbursementAmount

Total Disbursement amount.

Float

X

9

discountAmount

Discount Amount

Float

X

10

disbursementFee

Disbursement Fee

Float

X

11

discountDate

Employer identification number provided by the employer.

String (YYYY-MM-DD)

X

12

renewalIncrement

Renewal Number

Integer

X

13

applidationId

Application ID

Object

X

14

fundedDate

Date the loan was funded.

String (YYYY-MM-DD)

15

customerId

ID associated with the customer that took out the loan.

Integer

  • FK

X

16

leadID

ID associated with the lead corresponding to this loan.

Integer

  • FK

X

17

ccrScore

Credit Score

Integer

X

18

clarityScore

Clarity Score

Integer

X

19

files

Object

20

name

File name with the file format.

String

21

data

The raw data of the file.

String (Base64 encoded file content).

Response

The response will indicate the success or failure of the request to the Loans endpoint. The details of the response may vary based on the implementation of the API. A typical response will be a JSON object containing a success message or an error message.

Example POST Request

The following example is how one would create a loan record in the TaskSuite system.

Body

{
   "loanAmount": 1000000.11,
   "loanTerm": 52,
   "contractDate": "2024-05-22",
   "firstPaymentDate": "2024-06-22",
   "loanClass": "gold",
   "loanType": "instalment",
   "oFee": 200.55,
   "disbursementAmount": 800000.88,
   "discountSavings": 0.00,
   "discountDate": "2024-05-27",
   "renewalIncrement": 8,
   "applicationId": 79834,
   "disbursementFee": 25.99,
   "fundedDate": "2024-06-13",
   "partnerId": 75475,
   "leadId": 456312,
   "ccrScore": 800,
   "clarityScore": 788,
   "files": [
      {
        "name": "signed_contract_1.pdf",
        "data": "JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoK..."
      },
      {
        "name": "signed_contract_2.pdf",
        "data": "UEsDBBQAAAAIAGWOOU/Wh7XIAgAAAAwAAAJAAAALd..."
      },
      {
        "name": "signed_terms_and_conditions_1.pdf",
        "data": "MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRml..."
      }
   ]
}

Example (Python)

import requests
import json

url = "https://www.giggle.tasksuite.com/webhook/json/v1/loans"

headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <api_key>'
}

payload = json.dumps({
   "loanAmount": 1000000.11,
   "loanTerm": 52,
   "contractDate": "2024-05-22",
   "firstPaymentDate": "2024-06-22",
   "loanClass": "gold",
   "loanType": "instalment",
   "oFee": 200.55,
   "disbursementAmount": 800000.88,
   "discountSavings": 0.00,
   "discountDate": "2024-05-27",
   "renewalIncrement": 8,
   "applicationId": 79834,
   "disbursementFee": "25.99",
   "fundedDate": "2024-06-13",
   "partnerId": 75475,
   "leadId": 456312,
   "ccrScore": 800,
   "clarityScore": 788,
   "files": [
      {
        "name": "signed_contract_1.pdf",
        "data": "JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoK..."
      },
      {
        "name": "signed_contract_2.pdf",
        "data": "UEsDBBQAAAAIAGWOOU/Wh7XIAgAAAAwAAAJAAAALd..."
      },
      {
        "name": "signed_terms_and_conditions_1.pdf",
        "data": "MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRml..."
      }
   ]
})

response = requests.request("POST", url, headers=headers, data=payload)

Example Response (Success)

{
    "statusCode": 200,
    "status": "OK",
    "message": "Loan Successfully Created",
    "error": false,
    "loanId": 123456
}

Example Response (Failure)

{
    "statusCode": 400,
    "description": "Did not provide 'loanAmount'",
    "name": "Bad Request"
}

Error Handling

In case of errors, the response will contain an appropriate error message with details on what caused the error. Make sure to handle these errors.

Notes

  • Ensure that the required fields are provided in the request body; otherwise, the API will return an error indicating the missing fields.

  • The <api_key> in the headers must be valid and active for the Loan creation to be successful.


Read a Loan Record

End Point URL

https://www.giggle.tasksuite.com/webhook/json/v1/loans/<loan_id:int>

Request Method

GET

Request Body

None

Response

The response will indicate the success or failure of the request to the Loans endpoint. The details of the response may vary based on the implementation of the API. A typical response will be a JSON object containing a success message or an error message.

Example GET Request

The following is an example of how one would perform a GET request for a loan record in the TaskSuite system.

Example (Python)

import requests
import json

url = "https://www.giggle.tasksuite.com/webhook/json/v1/loans/<loan_id:int>"


headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <api_key>'
}

response = requests.request("GET", url, headers=headers)

Example Response (Success)

{
   "id": 768943,.
   "state": "draft",
   "loanAmount": 1000000.11,
   "loanTerm": 52,
   "contractDate": "2024-05-22",
   "firstPaymentDate": "2024-06-22",
   "loanClass": "gold",
   "loanType": "instalment",
   "oFee": 200.55,
   "disbursementAmount": 800000.88,
   "discountSavings": "0.00",
   "discountDate": "2024-05-27",
   "renewalIncrement": 8,
   "applicationId": 79834,
   "disbursementFee": "25.99",
   "fundedDate": "2024-06-13",
   "partnerId": 75475,
   "leadId": 456312,
   "ccrScore": 800,
   "clarityScore": 788,
   "daysOverDue": 12,
   "amountOverdue": 1987.32,
   "contractBalance": 421123.33,
   "files": [
      {
        "fileId": 1235,
        "name": "signed_contract_1.pdf",
        "data": "JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoK..."
      },
      {
        "fileId": 78342,
        "name": "signed_contract_2.pdf",
        "data": "UEsDBBQAAAAIAGWOOU/Wh7XIAgAAAAwAAAJAAAALd..."
      },
      {
        "fileId": 7852,
        "name": "signed_terms_and_conditions_1.pdf",
        "data": "MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRml..."
      }
   ]
}

Example Response (Failure)

{
    "statusCode": 400,
    "description": "Loan ID <ID> not found.",
    "name": "Bad Request"
}

Error Handling

In case of errors, the response will contain an appropriate error message with details on what caused the error. Make sure to handle these errors.

Notes

  • Ensure that the required fields are provided in the request body; otherwise, the API will return an error indicating the missing fields.

  • The <api_key> in the headers must be valid and active for the access to the Loan record to be successful.


Update a Loan Record

End Point URL

https://www.giggle.tasksuite.com/webhook/json/v1/loans/<loan_id:int>

Request Method

PATCH

Request Body

The request body must be a JSON payload with the following fields. Please keep in mind that all fields are optional.

Field

Sub-Field

Description

Data Type/Format

1

state

The state of the loan. Possible values include

  • “draft”, “declined”, “active”, “paid”, “written_off”, “archived”

String

2

loanAmount

Total payback amount of the loan.

Float

  • Only to the hundredths place.

  • (e.g. 2000.220

3

loanTerm

Term of the loan in number of weeks

Integer

4

contractDate

Date the contract was signed.

String (YYYY-MM-DD)

5

firstPaymentDate

First payment date of the loan.

String (YYYY-MM-DD)

6

loanClass

Class of the Loan

String

7

loanType

Type of loan, (e.g. “Instalment”)

String

8

oFee

Origination fee of the loan.

Float

9

disbursementAmount

Total Disbursement amount.

Float

10

discountAmount

Discount Amount

Float

11

disbursementFee

Disbursement Fee

Float

12

discountDate

Employer identification number provided by the employer.

String (YYYY-MM-DD)

13

renewalIncrement

Renewal Number

Integer

14

fundedDate

Date the loan was funded.

String (YYYY-MM-DD)

15

ccrScore

Credit Score

Integer

16

clarityScore

Clarity Score

Integer

17

files

Object

18

fileId

If a file id is provided, it is assumed that this file Id is to be updated and not created. The file with the corresponding id will be searched for and updated. If the intention is to create a new file do not include the file id.

19

name

Name of the file, this name must be unique per loan record. No two files linked to the same loan are permitted to have the same name.

String

20

data

The raw data of the file.

String (Base64 encoded file content).

Response

The response will indicate the success or failure of the request to the Contact endpoint. The details of the response may vary based on the implementation of the API. A typical response will be a JSON object containing a success message or an error message.

Example PATCH Request

The following example is how one would update a loan record in the TaskSuite system.

Body

{
   "state": "active",
   "loanAmount": 1000000.11,
   "loanTerm": 52,
   "contractDate": "2024-05-22",
   "firstPaymentDate": "2024-06-22",
   "loanClass": "gold",
   "loanType": "instalment",
   "oFee": 200.55,
   "disbursementAmount": 800000.88,
   "discountSavings": "0.00",
   "discountDate": "2024-05-27",
   "renewalIncrement": 8,
   "disbursementFee": "25.99",
   "fundedDate": "2024-06-13",
   "ccrScore": 800,
   "clarityScore": 788,
   "daysOverDue": 12,
   "amountOverdue": 1987.32,
   "contractBalance": 421123.33,
   "files": [
      {
        "name": "signed_contract_1.pdf",
        "data": "JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoK..."
      },
      {
        "name": "signed_contract_2.pdf",
        "data": "UEsDBBQAAAAIAGWOOU/Wh7XIAgAAAAwAAAJAAAALd..."
      },
      {
        "fileId": 6784,
        "name": "signed_terms_and_conditions_1.pdf",
        "data": "MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRml..."
      }
   ]
}

Example (Python)

import requests
import json

url = "https://www.giggle.tasksuite.com/webhook/json/v1/loans/<loan_id:int>"

headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <api_key>'
}

payload = json.dumps({
   "state": "active",
   "loanAmount": 1000000.11,
   "loanTerm": 52,
   "contractDate": "2024-05-22",
   "firstPaymentDate": "2024-06-22",
   "loanClass": "gold",
   "loanType": "instalment",
   "oFee": 200.55,
   "disbursementAmount": 800000.88,
   "discountSavings": "0.00",
   "discountDate": "2024-05-27",
   "renewalIncrement": 8,
   "disbursementFee": "25.99",
   "fundedDate": "2024-06-13",
   "ccrScore": 800,
   "clarityScore": 788,
   "daysOverDue": 12,
   "amountOverdue": 1987.32,
   "contractBalance": 421123.33,
   "files": [
      {
        "name": "signed_contract_1.pdf",
        "data": "JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoK..."
      },
      {
        "name": "signed_contract_2.pdf",
        "data": "UEsDBBQAAAAIAGWOOU/Wh7XIAgAAAAwAAAJAAAALd..."
      },
      {
        "fileId": 123,
        "name": "signed_terms_and_conditions_1.pdf",
        "data": "MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRml..."
      }
   ]
})

response = requests.request("PATCH", url, headers=headers, data=payload)

Example Response (Success)

{
    "statusCode": 200,
    "status": "OK",
    "message": "Loan Successfully Updated",
    "error": false,
    "loanId": 123456,
}

Example Response (Failure)

{
    "statusCode": 400,
    "description": "Loan ID <ID> not found.",
    "name": "Bad Request"
}

Error Handling

In case of errors, the response will contain an appropriate error message with details on what caused the error. Make sure to handle these errors.

Notes

  • Ensure that the required fields are provided in the request body; otherwise, the API will return an error indicating the missing fields.

  • The <api_key> in the headers must be valid and active for the access to the Loan record to be successful.


DELETE a Loan Record

End Point URL

https://www.giggle.tasksuite.com/webhook/json/v1/loans/<loan_id:int>

Request Method

DELETE

Request Body

None

Response

The response will indicate the success or failure of the request to the Loan endpoint. The details of the response may vary based on the implementation of the API. A typical response will be a JSON object containing a success message with the details of the Loan or an error message.

Example (Python)

import requests
import json

url = "https://www.giggle.tasksuite.com/webhook/json/v1/loans/<loan_id:int>"

headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <api_key>'
}

response = requests.request("DELETE", url, headers=headers)

Example Response (Success)

{
    "statusCode": 200,
    "status": "OK",
    "message": "Loan Successfully Deleted",
    "error": false,
    "loanId": 123456,
}

Example Response (Failure)

{
    "statusCode": 400,
    "description": "Loan ID <ID> not found.",
    "name": "Bad Request"
}

Error Handling

In case of errors, the response will contain an appropriate error message with details on what caused the error. Make sure to handle these errors.

Notes

  • Ensure that the required fields are provided in the request body; otherwise, the API will return an error indicating the missing fields.

  • The <api_key> in the headers must be valid and active for the access to the Loan record to be successful.


Support

If there are any errors or discrepancies with this document or the related API endpoints. Please reach out to support@tasksuite.com and a support engineer with handle your query.

  • No labels