1. Home
  2. Manipulating dependency lists and tables through the API

Manipulating dependency lists and tables through the API

Introduction

Here is a list of all the queries that are available to you to manipulate your dependency lists and tables.

These allow you to add, select, update, and delete.

Manipulating lists

[GET] /list/lists

Returns a list of all your existing lists without their elements

Result obtained :

[
  {
    "name": "Liste des clients",
    "description": "Répertorie nos clients",
    "id": 1,
    "elements": []
  },
  {
    "name": "Liste des produits en vente",
    "description": "Répertorie les produits que l'on vend",
    "id": 2,
    "elements": []
  }
]

[GET] /list/{listId}

Returns the list (name, description, id and elements) whose Id was transmitted by the path.

Result obtained :

{
  "name": "Liste des clients",
  "description": "Répertorie nos clients",
  "id": 1,
  "elements": [
    "Amélie",
    "Bernard"
  ]
}

[POST] /list/list

Create a new list (name and description) without the contained elements.

Body of the request:

{
  "name": "Liste des catégories des produits",
  "description": "Répertorie les catégories des produits mis en vente"
}

Good to know: It is not necessary to fill in the Id or the elements. These two parameters will, in any case, not be taken into account.

Result obtained :

A new EMPTY list named “List of product categories” with the description “List of product categories for sale” which will have an auto-incrementally generated Id.

[POST] /list/{listId}

Modifies the list items whose Id was passed by the path.
The elements that were already present will remain unchanged. Items that exist but are not present in the body of the query will be deleted.

Body of the request:

{
  "elements": [
    "Amélie", "Manon", "Marie-Lou", "Laure"
  ]
}

It is not necessary to fill in the name, description and Id. These three parameters will, in any case, not be taken into account.

Result obtained :

The list with the Id entered in the path will have the following elements: Amélie / Manon / Marie-Lou / Laure.

  • “Amélie” was already present in the list, no modification is made on this item.
  • “Manon”, “Marie-Lou” and “Laure” were not present, so they were created.
  • On the other hand, “Bernard” was previously present in the list, so it is deleted.

[PUT] /list/{listId}/items

Inserts elements in the list whose Id was passed by the path.

Body of the request:

[
  "Olivier",
  "Thomas",
  "Alex"
]

Result obtained :

The list with the Id filled in the path (1 in this case) will have three new elements : Olivier / Thomas / Alex.

[PUT] /list/{listId}/items/delete

Deletes items in the list whose Id was passed by the path.

Body of the request:

[
  "Marie-Lou",
  "Laure"
]

Result obtained :

The two elements “Marie-Lou” and “Laure” will be removed from the list with the Id filled in the path.

[DELETE] /list/{listId}

Deletes the list whose Id was transmitted by the path.

Result obtained :

The list having for Id the one indicated in the path no longer exists.

Dependency tables

[GET] /list/dependencies

Returns the details of all dependency tables without mentioning related elements.

Result obtained :

[
  {
    "name": "Client > Articles achetés",
    "description": "La liste des articles achetés pour chaque client",
    "id": 1,
    "sourceType": "LIST",
    "sourceId": 1,
    "targetType": "LIST",
    "targetId": 2,
    "linkedElements": []
  }
]

[GET] /list/dependency/{dependencyTableId}

Returns the details of the dependency table that has the Id specified in the path, mentioning its related elements.

Result obtained :

{
  "name": "Client > Articles achetés",
  "description": "La liste des articles achetés pour chaque client",
  "id": 1,
  "sourceType": "LIST",
  "sourceId": 1,
  "targetType": "LIST",
  "targetId": 52,
  "linkedElements": [
    {
      "source": "Amélie",
      "target": "Téléphone portable"
    },
    {
      "source": "Manon",
      "target": "Télévision"
    },
    {
      "source": "Marie-Lou",
      "target": "Ordinateur portable"
    },
    {
      "source": "Laure",
      "target": "Tablette tactile"
    }
  ]
}

[POST] /list/dependency

Create a dependency table (name, description, and related lists) without dependencies.

Body of the request:

{
  "name": "Articles > Catégories",
  "description": "Les articles et leurs catégories associées",
  "sourceType": "LIST",
  "sourceId": 2,
  "targetType": "LIST",
  "targetId": 3
}

Good to know: It is not necessary to fill in the Id or the elements to be linked. These two parameters will, in any case, not be taken into account.

Result obtained :

A new dependency table named “Items > Categories” with the description “Items and their associated categories” that will have an auto-incrementally generated Id and will have no dependency information is created.

[POST] /list/dependency/{dependencyTableId}

Changes the dependency table relationships whose Id was passed by the path.
The existing connections will remain unchanged. Those already existing but not present in the body of the query will be deleted.

Body of the request:

{
  "linkedElements": [
    {
      "source": "Téléphone portable",
      "target": "Téléphonie"
    },
    {
      "source": "Télévision",
      "target": "Image & Son"
    },
    {
      "source": "Ordinateur portable",
      "target": "Informatique"
    },
    {
      "source": "Tablette tactile",
      "target": "Informatique"
    }
  ]
}

Good to know: It is only necessary to fill in the related elements, the other parameters will not be taken into account.

Let’s assume that only the associations “Laptop”-“Computer”, “Mobile Phone-“Telephony” and “Sound bar”-“Image and Sound” exist.

Result obtained :

The dependency table with the Id entered in the path will have the 4 associations indicated in the body of the query.

  • The associations “Mobile phone”-“Telephony” and “Laptop”-“Computing” already exist, so no changes are made.
  • The association “Touch Tablet” and “Computing” did not exist, so it was created.
  • However, the previously existing association “Sound bar” and “Image & Sound” is deleted.

Inserts new links in the dependency table whose Id has been passed by the path.

Body of the request:

[
  {
    "source": "Souris sans fil",
    "target": "Informatique"
  },
  {
    "source": "Casque audio sans fil",
    "target": "Image & Son"
  }
]

Result obtained :

The dependency table with the Id entered in the path will have two new associations: “Wireless Mouse”-“Computer” and “Wireless Headset”-“Image & Sound”.

Deletes relationships in the dependency table whose Id was passed by the path.

Body of the request:

[
  {
    "source": "Imprimante",
    "target": "Téléphonie"
  }
]

Result obtained :

The “Printer”-“Telephony” association of the dependency table with the Id entered in the path will no longer exist.

[DELETE] /list/dependency/{dependencyTableId}

Deletes the dependency table whose Id was passed by the path.

Result obtained :

The dependency table having for Id the one indicated in the path no longer exists.

Business repositories

Refer to the page that explains how to manipulate business repositories through the API.

Updated on 13 November 2020

Was this article helpful?

Need Support?
Can't find the answer you're looking for?
Contact Support