Information APIs

Server-side API

The server side rest API allows retrieving information about the listed products. Use this API in your own website to
  • Show the funding progress of your campaigns
  • Add a component that shows recent investments on your platform
Use the following URL in your browser to test the API response: https://staging.cashlink-staging.de/api/external-info/​
The response will look like this:
1
GET <server URL TBD>/api/external-info/
2
​
3
{
4
"user": null,
5
"products": [
6
{
7
"name": "Issuer issuer 1 Token",
8
"type": "DIGITAL_COMPANY_SHARE",
9
"volume": {"amount": "500000000", "decimals": 3, "currency": "EUR"},
10
"investment_sum": {"amount": "41000000", "decimals": 3, "currency": "EUR"},
11
"investment_count": 2,
12
"recent_investments": [
13
{
14
"signed_date": "2020-07-14T17:07:08.243552Z",
15
"amount": {"amount": "1000000", "decimals": 3, "currency": "EUR"},
16
"postal_code": null
17
},
18
{
19
"signed_date": "2020-07-14T16:40:07.673258Z",
20
"amount": {"amount": "40000000", "decimals": 3, "currency": "EUR"},
21
"postal_code": "12345"
22
}
23
]
24
},
25
{
26
"name": "Issuer issuer 2 Token",
27
"type": "BOND",
28
"volume": {"amount": "500000000", "decimals": 3, "currency": "EUR"},
29
"investment_sum": {"amount": "40000000", "decimals": 3, "currency": "EUR"},
30
"investment_count": 1,
31
"recent_investments": [
32
{
33
"signed_date": "2020-07-14T16:40:20.461359Z",
34
"amount": {"amount": "40000000", "decimals": 3, "currency": "EUR"},
35
"postal_code": "12345"
36
}
37
]
38
}
39
]
40
}
Copied!
Notes
Monetary values are represented as a combination of amount, decimals & currency. For example, {"amount": "40000000", "decimals": 3, "currency": "EUR"} means "40000.000 EUR"

Client-side user API

Via the client-side API, you can retrieve information on your own website about the user currently logged in.
Please note that in order to call the API from the client-side the originating domain needs to be whitelisted. Please reach out to your point of contact at Cashlink so that we can whitelist your domain.
Use this API to
  • Show the login status of your users when visiting your website
  • Display user specific information like email address
  • Show or hide certain areas of your website based on the login status
If the user is logged in the user can be sent directly to the investor dashboard using this URL:
<server-url>/dashboard/investorOverview
The URL above will render a log in page if the user is not logged in, but if you want them to go directly to the login view you can use the following URL
<server-url>/login
User information can be retrieved client-side via postMessage:
1
<pre id="info">
2
<pre>
3
​
4
<iframe style="visibility: hidden; display: none" id=frame src="https://staging.cashlink-staging.de/external-info"></iframe>
5
​
6
<script>
7
let origin = 'https://staging.cashlink-staging.de';
8
let el = document.getElementById('frame');
9
​
10
function printInfo(user) {
11
let msg;
12
if (user) {
13
msg = `Name: ${user.name}\nE-Mail: ${user.email}`;
14
} else {
15
msg = "Not logged in";
16
}
17
document.getElementById('info').innerText = msg;
18
}
19
​
20
el.addEventListener('load', () => {
21
window.addEventListener('message', (evt) => {
22
if (evt.origin == origin) {
23
let res = evt.data;
24
console.log('response:', res);
25
if (res.success && res.result.user) {
26
printInfo(res.result.user);
27
} else {
28
printInfo(null);
29
}
30
}
31
});
32
el.contentWindow.postMessage({method: 'getExternalInfo'}, origin);
33
});
34
</script>
Copied!
The response in the success case will be of the format
1
{
2
"success": true,
3
"result": {
4
"user": {"email": "[email protected]", "name": "Maria Mustermann"},
5
"products": [/*... <same as for server-side API>*/]
6
}
7
}
Copied!
In the failure case, the response format will be
1
{
2
"success": false,
3
"error": "could not fetch data"
4
}
Copied!
This can only occur when Cashlink servers are not reachable. If the user is not logged in, the response will be
1
{
2
"success": true,
3
"result": {"user": null, "products": [/*...*/]}
4
}
Copied!
​