Joy comes with several API already available. This chapter details the ready to use api calls.

API global calls

Globally all the api calls (RESTFul) looks like this

GET [URL]/api/[...]

Getting data from an Joy Entity

Joy provides data access through a database by using simple configuration. All the data objects managed by the framework are called entities and it’s possible to get data from these entities through rest calls :

Get entity matrix/array (bideminesionnal) with filters :
GET [URL]/api/entity/[entity name]?filter1=value1&filter2=value2

Get entity matrix with filters and row count limitation
GET [URL]/api/entity/[entity name]?filter1=value1&filter2=value2&rowcount=value3

Note : This calls needs an entry into the rest-config.json configuration file (Cf. joyConfiguration)

Copy and add this code into your rest-config.json file :

[code language= »css »]
{
"name": "entity",
"class": "com.joy.api.ready.RESTEntity",
"mime": "application/json"
},
[/code]

Get ready for Chart.js

One other strengh of the framework is to prepare data for charting. The framework can format the data as they are waited by chart.js

These are the api calls to get these data directly from joy entities :

Get filtered entity data for single dataset
GET [URL]/api/charts/[entity name]/sds?filter1=value1&filter2=value2
Get filtered entity data for multiple dataset
GET [URL]/api/charts/[entity name]/mds?filter1=value1&filter2=value2
Get filtered entity data for single dataset and row limitation
GET [URL]/api/charts/[entity name]/sds?filter1=value1&filter2=value2&rowcount=value3
Get filtered entity data for multiple dataset and row limitation
GET [URL]/api/charts/[entity name]/mds?filter1=value1&filter2=value2&rowcount=value3

One more time you need a new entry into your rest-config.json, so just copy and add this code into the file :

[code language= »css »]
{
"name": "charts",
"class": "com.joy.api.ready.RESTChartJS",
"mime": "application/json"
},
[/code]

Joy entities Check

This api call checks the validity of the configured joy entities :

GET [URL]/api/checks

You need this entry in your rest-config.json

[code language= »css »]
{
"name": "checks",
"class": "com.joy.api.ready.RESTJoyCheck",
"mime": "application/json"
},
[/code]

Parameters

This api call get all the application parameters :

GET [URL]/api/parameters

You need this entry in your rest-config.json

[code language= »css »]
{
"name": "srctermtype",
"class": "com.dgm.api.src.RESTSrcTermType",
"mime": "application/json"
},
[/code]

Tasks list

This api call get all the tasks (asynchronous treatments) list :

GET [URL]/api/taskslist

You need this entry in your rest-config.json

[code language= »css »]
{
"name": "taskslist",
"class": "com.joy.api.ready.RESTTasksList",
"mime": "application/json"
},
[/code]

Partager cet article