6. API endpoints - DataList Endpoints

Page / - last modified by Outhman Moustaghfir on 2022/06/13 13:17

DataList Endpoints

last modified by Outhman Moustaghfir

on 2022/06/13 13:17

Table of Contents

Introduction

Endpoints

Introduction

The endpoints below help in creating, updating, deleting, or getting DataLists.

Endpoints

All datalists are grouped by the current environment.

URL [method]	Description	Input example	Output example	Comments
/rest/datalist [GET]	get all datalists of the current environment.	(no input required)	{ "timestamp": 1638194413239, "status": "200", "data": [ { "datalistid": null, "alias": "country", "label": { "fr": "pays", "en": "country" }, "env": "iXPath", "global": true, "values": [ { "alias": "Morocco", "label": { "fr": "Maroc", "en": "Morocco" }, "value": "Maroc" }, { "alias": "Russia", "label": { "fr": "Russie", "en": "Russia" }, "value": "Russia" } ] }, { "datalistid": null, "alias": "city", "label": { "fr": "Ville", "en": "City" }, "env": "iXPath", "global": false, "values": [ { "alias": "Casablanca", "label": { "fr": "Casablanca", "en": "Casablanca" }, "value": "Casablanca" }, { "alias": "Fez", "label": { "fr": "Fes", "en": "Fez" }, "value": "Fez" } ] } ] }
/rest/datalist/{alias} [GET]	get a datalist by alias.	the {alias} must be replaced by the wanted alias. eg : /rest/datalist/city /rest/datalist/country	for : /rest/datalist/city, the response will look like : { "timestamp": 1638194572812, "status": "200", "data": { "datalistid": null, "alias": "city", "label": { "fr": "Ville", "en": "City" }, "env": "iXPath", "global": false, "values": [ { "alias": "Casablanca", "label": { "fr": "Casablanca", "en": "Casablanca" }, "value": "Casablanca" }, { "alias": "Fez", "label": { "fr": "Fes", "en": "Fez" }, "value": "Fez" } ] } }
/rest/datalist [POST]	add a new datalist.	{ "alias" : "city", "label" : { "fr" : "Ville", "en" : "City" }, "global" : false, "values" : [ { "alias" : "Casablanca", "label" : { "fr" : "Casablanca", "en" : "Casablanca" }, "value" : "Casablanca" }, { "alias" : "Fez", "label" : { "fr" : "Fes", "en" : "Fez" }, "value" : "Fez" }] }	the response is the object added to the database. { "timestamp": 1638194247251, "status": "200", "data": { "datalistid": null, "alias": "city", "label": { "fr": "Ville", "en": "City" }, "env": "iXPath", "global": false, "values": [ { "alias": "Casablanca", "label": { "fr": "Casablanca", "en": "Casablanca" }, "value": "Casablanca" }, { "alias": "Fez", "label": { "fr": "Fes", "en": "Fez" }, "value": "Fez" } ] } }
/rest/datalist/{alias} [PUT]	update an existing datalist by the alias	to update the datalist, we need to replace the {alias} brackets with the concerned datalist's alias And add a JSON body like: { "alias" : "city", "label" : { "fr" : "Ville", "en" : "City" }, "global" : false, "values" : [ { "alias" : "Casablanca", "label" : { "fr" : "Casablanca", "en" : "Casablanca" }, "value" : "Casablanca" }, { "alias" : "Fez", "label" : { "fr" : "Fes", "en" : "Fez" }, "value" : "Fez" }, { "alias" : "London", "label" : { "fr" : "Londres", "en" : "London" }, "value" : "london" }] } we added a new value to datalist's values list.	the response is the object updated to the database. { "timestamp": 1638194808497, "status": "200", "data": { "datalistid": null, "alias": "city", "label": { "fr": "Ville", "en": "City" }, "env": "iXPath", "global": false, "values": [ { "alias": "Casablanca", "label": { "fr": "Casablanca", "en": "Casablanca" }, "value": "Casablanca" }, { "alias": "Fez", "label": { "fr": "Fes", "en": "Fez" }, "value": "Fez" }, { "alias": "London", "label": { "fr": "Londres", "en": "London" }, "value": "london" } ] } }
/rest/datalist/{alias} [DELETE]	delete a datalist by alias.	the {alias} must be replaced by the wanted alias. eg : /rest/datalist/city /rest/datalist/country	the response returned is only a message confirming the delete of datalist. { "timestamp": 1638195209684, "status": "200", "data": "dataList removed successfully" }