# Request - JSON

The API support JSON formatted responses.&#x20;

This solution puts higher requirements on the integration since the data isn't formatted. It means you have to handle the locale, percent formation, signs for positives/negatives and so on.

## Get widget

<mark style="color:blue;">`GET`</mark> `https://widget.datablocks.se/api/rose/widgets/:widgetType?token=:tokenId&type=json`

Get JSON formatted data (The response is an example of the owner-list)

### Path Parameters

| Name                                         | Type   | Description                           |
| -------------------------------------------- | ------ | ------------------------------------- |
| widgetType<mark style="color:red;">\*</mark> | string | Specific widget (example: owner-list) |

### Query Parameters

| Name                                    | Type   | Description                                         |
| --------------------------------------- | ------ | --------------------------------------------------- |
| token<mark style="color:red;">\*</mark> | string | Credential provided by MF, specific for each widget |

## Example

{% tabs %}
{% tab title="200 Widget recieved" %}

```javascript
{
    "numOfOwners": 61430,
    "numOfOwnersDate": "2018-12-31",
    "numOfShares": 455351068,
    "numOfSharesDate": "2018-12-31",
    "ownerSum": [
        {
        "capital": 0.40042998208142994,
        "holdingDate": "",
        "numOfShares": 182336220,
        "ownerName": "Total 10",
        "votes": 0.472891015466023
        }
    ],
    "owners": [
        {
        "capital": 0.13821456766628248,
        "holdingDate": "2018-12-31",
        "numOfShares": 62936151,
        "ownerName": "FAM AB",
        "votes": 0.2876165162710123
        },
        {
        "capital": 0.07044806140654533,
        "holdingDate": "2018-12-31",
        "numOfShares": 32078600,
        "ownerName": "Harris Associates",
        "votes": 0.04245709733515821
        },
        {
        "capital": 0.037131596230273914,
        "holdingDate": "2018-12-31",
        "numOfShares": 16907912,
        "ownerName": "Didner & Gerge Fonder",
        "votes": 0.02238059890896779
        }
    ]
}
```

{% endtab %}

{% tab title="500 The data is corrupted." %}

```javascript
{
    "message": "Internal server error"
}
```

{% endtab %}
{% endtabs %}

## Calendar - JSON

In JSON-integration, the data that is used to build the calendar is provided. Note that this means that you have to handle logic like deciding when to show the end date of an event (presumably based on the `includeEnd` field), whether to show times (based on the `includeTime` field), how to format everything, and so on. Language selection and time locale are, however, handled by the backend.

The JSON API is located at `https://widget.datablocks.se/proxy/calendar/:widgetId/:language`

&#x20;**IMPORTANT:** `timeLocation` and `languageFallback` should be provided as query parameters (The backend will default to `UTC` and `false` respectively if they are not provided or not correct).

Thus, a typical request might look like:

[`https://widget.datablocks.se/proxy/calendar/<widgetId>/fi?time-location=Europe/Helsinki&languageFallback=false`](https://widget.datablocks.se/proxy/calendar/c142b269-7f64-4b41-8a4c-09ba0b41efc4/fi?time-location=Europe/Helsinki\&languageFallback=false)

### Other available integration methods

* [Request - HTML](https://modfin.gitbook.io/datablocks/-LYRjiiPF4zveC0T_zB_/integration/request-html)
* [JS-loader](https://modfin.gitbook.io/datablocks/-LYRjiiPF4zveC0T_zB_/integration/js-loader)
