How To Use The Rest API End Point - Create Records
Use this end-point to create records in your database. Only 1 record at a time can be posted in the
request.
POST Type End-Point
/api/v1/collect/data/{record}
Request Body
{
"business-logic": digit,
"data": {
"field": "string",
"field": "string",
...
}
}
Business Logic
When inserting records it is possible to control the application of business logic.
Business logic has two distinct parts. Pre-logic which occurs before the record is inserted and
post-logic which occurs after.
The values for Busines Logic are:
- 0: INSERT ONLY: No business logic is applied. The record is created using the columns
supplied in the request body and default columns will be inserted depending on the record type.
This is the simplest mode.
- 1: PRE-LOGIC STAGING: This mode applies the pre-logic to a virtual record and returns it
to the user. No physical record is inserted into the database. This mode would be used to
obtain a pre-filled record with stock data like Debtor File Number, Client Number, or
Transaction Breakdown Netting. You would then update the remaining fields and re-submit
the data back.
- 2: PRE-LOGIC ONLY: This will insert the record into the database with only the pre-logic
applied. This mode can be used for creating records that don't require any further processing
and can be posted to the database. Creating Clients or Cosigners is an example.
- 3: POST-LOGIC ONLY: This will insert the record into the database with only the post-logic
applied. If you used mode 1 to retrieve the stock data for further manipulation, then when
re-submit the data back, you would use this option for the post-logic processes.
- 4: FULL LOGIC: Inserts the record with pre and post-logic applied. This is the best option
for blind data submission. For example, if you were creating debtors and simply posted the
demographic information, this would run all the business logic. This option could also
be used for Transaction posting where you are simply submitting Transaction Type and
Amount.
All modes will result in a the full record to the user. Mode 1 is an exception in that no rowid
will be returned because no record is actually created in this mode.
Example
The below code only shows the first few lines of the table as an example. For the current schema,
please refer to the Printable Field Help Topic.
/api/v1/collect/data/debtor
{
"business-logic": 4,
"data": {
"de_rowid_client": "1",
"de_cl_account": "ABC123",
"de_class": "0",
"de_type": "RET",
"de_status": "NEW",
"de_name": "Doe, John",
...
}
}
Response Body
The response will include a status value. 200 is good. Everything else is a failure. If the response
is good, then the response will include the Data Type and Data.
{
"type": {
"recId": "string",
"rowId": "string"
},
"data": {
"field": "string",
...
}
}
Code |
Description |
recId |
This is the table name in the database. |
rowId |
This is the column name for the unique identifier for this table. |
Example
{
"type": {
"recId": "debtor",
"rowId": "de_rowid"
},
"data": {
"de_rowid": "123",
...
}
}
|
Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.
Please click this link to send us your comments: helpinfo@collect.org