Reference Data
Introduction
The Connector API for "Reference & Historize Data" allows external payment gateways to interact with the SOClass-based Customs system to exchange Reference and Historize tables.
Search Reference Data
This method allows the caller system to get paginated and filtered Reference or Historize data. When the data have been successfully retrieved, in the response body two values will appear: pageableId and checksum. The pageableId is used to manage further requests, e.g. which page caller to be retrieved. If some of the values of the request are changed, the pagableId will become invalid. The checksum value is used by the Connector endpoint to check if the already calculated data hash of the requested Reference or Historize table is valid (unchanged) or not. If it is valid, the requested pagination will be processed. If it is not valid, the Connector will reload the Reference|HT table, calculate the new checksum and then create a new pagination. The newly created pageableId and checksum will be included in the response with the refreshed data. The both old pageableId and checksum will become invalid.
Example: A certain reference table is retrieved and the following "checksum" is present in the response: "c4f0362db5e1df834853c5f9c59a02ba". After a certain period of time, a new request is sent to the Connector with the same parameters - same binder, table name and type (ARef or not). The request contains a new pagableId (which is normal) but the same checksum like the one in the previous request. This means that during this period no changes have been made in this Reference or Historize table according to the given request parameters.
Reference & HT Plugin Configuration
The following properties can be configured in order to achieve a certain behavior:
Clean period
solink.pageable.refdata.manager.clean.period=600000
A period of time (in milliseconds) after which the Ref&HT Data Managers will be cleaned. This is the period during which the Ref&HT Data endpoint can get next and previous pages. The default value is 10 minutes represented in milliseconds.
Checksum expiration period
solink.refdata.refresh.period=86400000
A period of time (in milliseconds) after which the previously calculated checksum of the Ref or HT Table will be removed and become invalid. The default value is a one day represented in milliseconds.
Checksum Hash Algorithm
solink.refdata.hash.algorithm=SHA3-256
The hash algorithm which will be used to calculate the Ref or HT Table checksum. The default value is "MD5".
Document Modules Configuration
To enable the Ref&HT Data Plugin the following configuration should be set in the current document module descriptor:
- enabled: <true | false>
pluginName: <DocName>/ref/<Table alias>
className: com.so.solink.app.apiimpl.core.plugin.generic.ReferenceServicePlugin
binderName: <Binder name>
startOperation: <Operation name>
tableName: <Reference or Historize table name>
shortcutId: <Optional shortcut ID>
requestPojoClass: com.so.solink.app.api.refdata.RefRequestPojo
responsePojoClass: com.so.solink.app.api.refdata.RefDataPageResults
Examples of the Demo Multipages module
- enabled: true
pluginName: multipages/ref/Country
className: com.so.solink.app.apiimpl.core.plugin.generic.ReferenceServicePlugin
binderName: so.demo DemoMultiPages
startOperation: New
tableName: CTY_TAB
shortcutId: 28
requestPojoClass: com.so.solink.app.api.refdata.RefRequestPojo
responsePojoClass: com.so.solink.app.api.refdata.RefDataPageResults
- enabled: true
pluginName: multipages/ht/Products
className: com.so.solink.app.apiimpl.core.plugin.generic.ReferenceServicePlugin
binderName: so.demo DemoMultiPages
startOperation: New
tableName: PRO_TAB_HISTO1
shortcutId: 28
requestPojoClass: com.so.solink.app.api.refdata.RefRequestPojo
responsePojoClass: com.so.solink.app.api.refdata.RefDataPageResults
- enabled: true
pluginName: multipages/ht/ProductsARef
className: com.so.solink.app.apiimpl.core.plugin.generic.ReferenceServicePlugin
binderName: so.demo ArefDemoMultiPages
startOperation: New
tableName: PRO_TAB_HISTO1
shortcutId: 30
requestPojoClass: com.so.solink.app.api.refdata.RefRequestPojo
responsePojoClass: com.so.solink.app.api.refdata.RefDataPageResults
Historize Tables
| Parameter | Description |
|---|---|
| HTTP REQUEST | https://solink/api/v1/doc/:binder/ht/:tableName/ |
| VERB | GET |
| HEADER | Header: Authorization: Bearer <TOKEN> Accepted Format: [JSON] |
ARGUMENTS
| Parameter | Type | Mandatory | Header/URL/JSON Payload | Description |
|---|---|---|---|---|
| access_token | String | mandatory | Header | Access token to connect to the Connector API. |
| pageableId | String | optional | URL | Pagination identifier. If it is empty, a new one will be created or the corresponding one will be used. |
| checksum | String | optional | URL | Historize table snapshot checksum. |
| size | Int | optional | URL | Number of entries returned per page. |
| page | Int | optional | URL | The ranking number of the first entry on the page. |
| date | String (Datetime ISO 8601 format) | optional | JSON | Snapshot date and time. |
| aref | Boolean | optional | URL | Determines if the reference is to ARef or not. Default value or if missing is false. |
| sort | String | optional | URL | The sort column name. |
| ascending | Boolean | optional | URL | The sort direction. Default value or if missing is true. |
| target | String | optional | JSON | The target column to search for by the keyword. |
| keyword | String | optional | JSON | String representing the words used by the user for filtering the results. |
BODY
The body is optional. If specified, it defines the filtering parameters.
Historize Data Body
- JSON
- XML
{
"date": "2006-02-17T23:00:00.000+0230",
"target": "Name",
"keyword": "Bu"
}
<?xml version="1.0" encoding="UTF-8" ?>
<historizeDataBody>
<date>2006-02-17T23:00:00.000+0230</date>
<target>Name</target>
<keyword>Bu</keyword>
</historizeDataBody>
Example Request
Request
curl http://solink/api/v1/doc/multipages/ht/Products?page=1&size=25&sort=PRO_COD&aref=false&ascending=false \
-H 'Authorization: Bearer bsdcojzT-9i4q-TaNE-0T8u-gEBcXE2U8jtu'
Response HTTP/1.1 200 OK
- JSON
- XML
{
"exceptions": [],
"errors": [],
"results": {
"content": [
{
"columns": [
{
"columnName": "PRO_INT",
"value": {
"type": "String",
"content": "01"
}
},
{
"columnName": "VALID_FROM",
"value": {
"type": "Date",
"content": "2006-01-17T13:30:00.000+00:00"
}
},
{
"columnName": "VALID_TO",
"value": {
"type": "Date",
"content": "2006-03-30T12:30:00.000+00:00"
}
},
{
"columnName": "PRO_COD",
"value": {
"type": "String",
"content": "Cheese"
}
},
{
"columnName": "PRO_PRI",
"value": {
"type": "String",
"content": "100"
}
}
]
},
{
"columns": [
{
"columnName": "PRO_INT",
"value": {
"type": "String",
"content": "02"
}
},
{
"columnName": "VALID_FROM",
"value": {
"type": "Date",
"content": "2006-01-17T13:30:00.000+00:00"
}
},
{
"columnName": "VALID_TO",
"value": {
"type": "Date",
"content": "2006-03-30T12:30:00.000+00:00"
}
},
{
"columnName": "PRO_COD",
"value": {
"type": "String",
"content": "Bread"
}
},
{
"columnName": "PRO_PRI",
"value": {
"type": "String",
"content": "200"
}
}
]
}
]
},
"pageableId": "0b63158b-e3e0-48b5-8e39-3cede712740e",
"checksum": "c4f0362db5e1df834853c5f9c59a02ba",
"refreshAfter": "2021-03-11T15:53:05.755+00:00",
"createdOn": "2021-03-11T15:51:05.755+00:00",
"changed": false,
"pageSize": 25,
"pageNumber": 1,
"totalPages": 1,
"totalElements": 2,
"numberOfElements": 2,
"sortColumn": "PRO_COD",
"last": true,
"firs": true
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<exceptions/>
<errors/>
<results>
<content>
<columns>
<columnName>PRO_INT</columnName>
<value>
<type>String</type>
<content>01</content>
</value>
</columns>
<columns>
<columnName>VALID_FROM</columnName>
<value>
<type>Date</type>
<content>2006-01-17T13:30:00.000+00:00</content>
</value>
</columns>
<columns>
<columnName>VALID_TO</columnName>
<value>
<type>Date</type>
<content>2006-03-30T12:30:00.000+00:00</content>
</value>
</columns>
<columns>
<columnName>PRO_COD</columnName>
<value>
<type>String</type>
<content>Cheese</content>
</value>
</columns>
<columns>
<columnName>PRO_PRI</columnName>
<value>
<type>String</type>
<content>100</content>
</value>
</columns>
</content>
<content>
<columns>
<columnName>PRO_INT</columnName>
<value>
<type>String</type>
<content>02</content>
</value>
</columns>
<columns>
<columnName>VALID_FROM</columnName>
<value>
<type>Date</type>
<content>2006-01-17T13:30:00.000+00:00</content>
</value>
</columns>
<columns>
<columnName>VALID_TO</columnName>
<value>
<type>Date</type>
<content>2006-03-30T12:30:00.000+00:00</content>
</value>
</columns>
<columns>
<columnName>PRO_COD</columnName>
<value>
<type>String</type>
<content>Bread</content>
</value>
</columns>
<columns>
<columnName>PRO_PRI</columnName>
<value>
<type>String</type>
<content>200</content>
</value>
</columns>
</content>
</results>
<pageableId>0b63158b-e3e0-48b5-8e39-3cede712740e</pageableId>
<checksum>c4f0362db5e1df834853c5f9c59a02ba</checksum>
<refreshAfter>2021-03-11T15:53:05.755+00:00</refreshAfter>
<createdOn>2021-03-11T15:51:05.755+00:00</createdOn>
<changed>false</changed>
<pageSize>25</pageSize>
<pageNumber>1</pageNumber>
<totalPages>1</totalPages>
<totalElements>2</totalElements>
<numberOfElements>2</numberOfElements>
<sortColumn>PRO_COD</sortColumn>
<last>true</last>
<firs>true</firs>
</response>
Reference Tables
| Parameter | Description |
|---|---|
| HTTP REQUEST | https://solink/api/v1/doc/:binder/ref/:tableName/ |
| VERB | GET |
| HEADER | Header: Authorization: Bearer <TOKEN> Accepted Format: [JSON] |
ARGUMENTS
| Parameter | Type | Mandatory | Header/URL/JSON Payload | Description |
|---|---|---|---|---|
| access_token | String | mandatory | Header | Access token to connect to the Connector API. |
| pageableId | String | optional | URL | Pagination identifier. If it is empty, a new one will be created or the corresponding one will be used. |
| size | Int | optional | URL | Number of entries returned per page. |
| checksum | String | optional | URL | Reference table checksum. |
| page | Int | optional | URL | The ranking number of the first entry on the page. |
| sort | String | optional | URL | The sort column name. |
| ascending | Boolean | optional | URL | The sort direction. Default value or if missing is true. |
| aref | Boolean | optional | URL | Determines if the reference is to ARef or not. Default value or if missing is false. |
| target | String | optional | JSON | The target column to search for by the keyword. |
| keyword | String | optional | JSON | String representing the words used by the user for filtering the results. |
BODY
The body is optional. If specified it defines the filtering parameters.
Reference Data Body
- JSON
- XML
{
"target": "Name",
"keyword": "Bu"
}
<?xml version="1.0" encoding="UTF-8" ?>
<referenceDataBody>
<target>Name</target>
<keyword>Bu</keyword>
</referenceDataBody>
Example Request
Request
curl http://solink/api/v1/doc/multipages/ref/Country?page=1&size=25&sort=Name&aref=false \
-H 'Authorization: Bearer bsdcojzT-9i4q-TaNE-0T8u-gEBcXE2U8jtu'
Response HTTP/1.1 200 OK
- JSON
- XML
{
"exceptions": [],
"errors": [],
"results": {
"content": [
{
"columns": [
{
"columnName": "Id",
"value": {
"type": "String",
"content": "BG"
}
},
{
"columnName": "Name",
"value": {
"type": "String",
"content": "Bulgaria"
}
}
]
},
{
"columns": [
{
"columnName": "Id",
"value": {
"type": "String",
"content": "BF"
}
},
{
"columnName": "Name",
"value": {
"type": "String",
"content": "Burkina Faso"
}
}
]
},
{
"columns": [
{
"columnName": "Id",
"value": {
"type": "String",
"content": "BI"
}
},
{
"columnName": "Name",
"value": {
"type": "String",
"content": "Burundi"
}
}
]
}
]
},
"pageableId": "bb517739-6d7c-48eb-be46-d7d0a39af49f",
"checksum": "a80302e3873e932131bbe38f6c9466a4",
"refreshAfter": "2021-03-11T15:53:05.755+00:00",
"createdOn": "2021-03-11T15:51:05.755+00:00",
"changed": false,
"pageSize": 25,
"pageNumber": 1,
"totalPages": 1,
"totalElements": 3,
"numberOfElements": 3,
"sortColumn": "Name",
"last": true,
"firs": true
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<exceptions/>
<errors/>
<results>
<content>
<columns>
<columnName>Id</columnName>
<value>
<type>String</type>
<content>BG</content>
</value>
</columns>
<columns>
<columnName>Name</columnName>
<value>
<type>String</type>
<content>Bulgaria</content>
</value>
</columns>
</content>
<content>
<columns>
<columnName>Id</columnName>
<value>
<type>String</type>
<content>BF</content>
</value>
</columns>
<columns>
<columnName>Name</columnName>
<value>
<type>String</type>
<content>Burkina Faso</content>
</value>
</columns>
</content>
<content>
<columns>
<columnName>Id</columnName>
<value>
<type>String</type>
<content>BI</content>
</value>
</columns>
<columns>
<columnName>Name</columnName>
<value>
<type>String</type>
<content>Burundi</content>
</value>
</columns>
</content>
</results>
<pageableId>bb517739-6d7c-48eb-be46-d7d0a39af49f</pageableId>
<checksum>a80302e3873e932131bbe38f6c9466a4</checksum>
<refreshAfter>2021-03-11T15:53:05.755+00:00</refreshAfter>
<createdOn>2021-03-11T15:51:05.755+00:00</createdOn>
<changed>false</changed>
<pageSize>25</pageSize>
<pageNumber>1</pageNumber>
<totalPages>1</totalPages>
<totalElements>3</totalElements>
<numberOfElements>3</numberOfElements>
<sortColumn>Name</sortColumn>
<last>true</last>
<firs>true</firs>
</response>
Receive Notification of Reference Data Updates from Connector API
Connector API can send a notification about new data being created or updated in the SOClass Server. In particular the external system can subscribe to receive notification events containing information about reference data.
The following section describes the JSON payload sent by the Connector application.
Notifications are sent using a common JSON payload object called Event, which is defined as follows.
Event Object
FIELDS
| Name | Type | Mandatory | Description |
|---|---|---|---|
| id | String | mandatory | Unique identifier for the event object. |
| type | String | Description of the event (e.g., data.created or data.modified). | |
| data | Event Data object | Event Data Object that contains either the document, or other objects related to the event. | |
| createdAt | String | Time at which the object was created. |
Possible events are:
- cuotab.created;
- cuotab.modified;
- cmptab.created;
- cmptab.modified;
- etc.
Event Data Object
FIELDS
| Name | Description |
|---|---|
| cuotab | Customs Table Data |
| cmptab | Company Table Data |
| Parameter | Description |
|---|---|
| HTTP REQUEST | https://external-system/api/v1/reference-data |
| VERB | POST |
| HEADER | Accepted Format: [JSON] |
ARGUMENTS
Refer to the Event object, which is the payload used in this web service.
This Event object contains all relevant information about what happened, including the type of event and the data associated with that event. The Connector application sends the Event object via an HTTP POST request.
The external system must define an endpoint in order to receive events, configure the Connector application so that it can send events via POST, verify that the endpoint is valid, and confirm that the endpoint receives events successfully.
To acknowledge receipt of an event, the CAP endpoint must return an HTTP 2xx status code.
The endpoint is disabled if it is unreachable for several consecutive days. All response codes outside of 2xx, including 3xx codes, indicate to the Connector application that the external system did not receive the event.
Example
Request
- JSON
- XML
curl https://external-system/api/v1/reference-data \
-H "SOLink-Signature: t=1492774677,v1=4237a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0cedsgfd435,v0=4gdbb59b2300aae63f272406069a9788598b792a944a07aba816b039gdsgdfg" \
-X POST \
-d ' {
"id": "xkjh_9238467948273",
"type": "cuotab.created",
"createdAt":"2018-01-01Z",
"dataObjectType": "CUOTAB",
"dataObject": {
"entryId": "3428374",
"cuoCod":"CUO12",
"cuoNam": "Customs Office 12",
"cuoPhone": "23432423423"
}
}
'
curl https://external-system/api/v1/reference-data \
-H 'Content-Type: application/xml' \
-H 'Accept: application/xml' \
-H "SOLink-Signature: t=1492774677,v1=4237a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0cedsgfd435,v0=4gdbb59b2300aae63f272406069a9788598b792a944a07aba816b039gdsgdfg" \
-X POST \
-d '<?xml version="1.0" encoding="UTF-8" ?>
<referenceData>
<id>xkjh_9238467948273</id>
<type>cuotab.created</type>
<createdAt>2018-01-01Z</createdAt>
<dataObjectType>CUOTAB</dataObjectType>
<dataObject>
<entryId>3428374</entryId>
<cuoCod>CUO12</cuoCod>
<cuoNam>Customs Office 12</cuoNam>
<cuoPhone>23432423423</cuoPhone>
</dataObject>
</referenceData>
'
Response HTTP/1.1 200 OK