Create a Loan
post
/bcws/webresources/v1.0/loans
Creates a new loan.
Request
There are no request parameters for this operation.
Supported Media Types
- application/xml
- application/json
The details of the loan to create.
Root Schema : schema
Type:
Show Source
object
-
accountRef: object
ResourceRef
-
amount(required): number
The loan amount.
-
channel(required): string
The channel requesting the loan. For example, USSD or IVR.
-
extension: object
extension
The extended attributes.
-
locale(required): string
The locale associated with the loan.
-
resourceId(required): number
The ID of the resource associated with the loan.
-
service: object
Service
A service associated with the bundle.
-
type: integer
(int32)
The type of loan. Can be one of the following:
- 0: Currency or emergency loan
- 1: Data loan
- 2: Hybrid loan
-
zoneMapName(required): string
The name of the zonemap associated with the loan.
-
zoneMapTarget(required): string
The zone map associated with the loan.
Nested Schema : ResourceRef
Type:
Show Source
object
-
id(required): string
The ID.
-
uri: string
The Uniform Resource Identifier (URI) associated with the resource.
Nested Schema : extension
Type:
object
The extended attributes.
Nested Schema : Service
Type:
object
A service associated with the bundle.
Show Source
-
serviceKey: string
The service key.
-
serviceType: string
The service type.
The details of the loan to create.
Root Schema : schema
Type:
Show Source
object
-
accountRef: object
ResourceRef
-
amount(required): number
The loan amount.
-
channel(required): string
The channel requesting the loan. For example, USSD or IVR.
-
extension: object
extension
The extended attributes.
-
locale(required): string
The locale associated with the loan.
-
resourceId(required): number
The ID of the resource associated with the loan.
-
service: object
Service
A service associated with the bundle.
-
type: integer
(int32)
The type of loan. Can be one of the following:
- 0: Currency or emergency loan
- 1: Data loan
- 2: Hybrid loan
-
zoneMapName(required): string
The name of the zonemap associated with the loan.
-
zoneMapTarget(required): string
The zone map associated with the loan.
Nested Schema : ResourceRef
Type:
Show Source
object
-
id(required): string
The ID.
-
uri: string
The Uniform Resource Identifier (URI) associated with the resource.
Nested Schema : extension
Type:
object
The extended attributes.
Nested Schema : Service
Type:
object
A service associated with the bundle.
Show Source
-
serviceKey: string
The service key.
-
serviceType: string
The service type.
Response
201 Response
The loan was created successfully.
400 Response
The request isn't valid.
500 Response
An internal server error occurred.
Examples
This example shows how to create a loan by submitting a POST request on the REST resource using cURL. For more information about cURL, see "Use cURL".
cURL Command
curl -X POST 'http://hostname:port/bcws/webresources/version/loans' -H 'content-type: application/json' -d @createLoan.json
where:
- hostname is the URL for the Billing Care REST server.
- port is the port for the Billing Care REST server.
- version is the version of the API you're using, such as v1.0.
- createLoan.json is the JSON file that specifies the loan to create.
Example of Request Body
This example shows the contents of the createLoan.json file sent as the request body.
{
"accountRef": {
"id": "0.0.0.1+-account+103319"
},
"amount": 50,
"resourceId": 1000095,
"channel" : "USSD",
"type" : 2
}
Example of Response Body
This example shows the contents of the response body in JSON format.
{
"extension": null,
"availableLoanBalance": 50,
"currentBalance": 1955,
"amount": 50,
"loanFee": 10,
"tax": 0,
"balances": [
{
"amount": -800,
"type": 1000095
},
{
"amount": -1000,
"type": 840
}
],
"availableLoanLimit": 9760,
"creditLimit": 10000,
"loanObj": {
"id": "0.0.0.1+-event-billing-loan_debit+335412619122889132",
"uri": null
},
"loanFeeObj": {
"id": "0.0.0.1+-event-billing-loan_fee+335412619122891436",
"uri": null
}
}