### List All Taxonomy Entries Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Use this command to get a list of all available taxonomy types such as jurisdiction, chamber, formation, etc. This helps in understanding the available categories for filtering and searching. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/taxonomy" ``` -------------------------------- ### Check Service Health (Available) Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Verify the availability status of the Judilibre API service. This example shows the response when the service is available. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/healthcheck" ``` -------------------------------- ### Retrieve Full Decision via GET /decision Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Fetch the complete text and metadata of a specific decision using its unique ID. Optionally highlight search terms within the returned content. ```bash # Récupérer une décision par son identifiant curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/decision?id=5fca7d162a251e6bf9c78514&resolve_references=true" # Récupérer une décision avec surlignage des termes de recherche curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/decision?id=5fca7d162a251e6bf9c78514&query=expropriation&operator=and" ``` -------------------------------- ### Effectuer une recherche via cURL Source: https://github.com/cour-de-cassation/judilibre-search/blob/dev/README.md Exemple de requête GET pour rechercher des décisions contenant le terme 'brevet' en utilisant l'API sandbox. ```bash curl -is -H "accept: application/json" -H "KeyId: %keyId%" -X GET "https://sandbox-api.piste.gouv.fr/cassation/judilibre/v1.0/search?query=brevet" ``` -------------------------------- ### Get Statistics for Appeal Courts Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Retrieve statistics specifically for appeal courts, aggregated by location and year. Requires an API key. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/stats?jurisdiction=ca&keys=location,year" ``` -------------------------------- ### Get Statistics by Jurisdiction and Year Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Fetch statistics aggregated by jurisdiction and year. Specify the desired keys for aggregation. Requires an API key. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/stats?keys=jurisdiction,year" ``` -------------------------------- ### Search Judicial Decisions via GET /search Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Perform full-text searches with optional filters like jurisdiction, date ranges, and sorting. Requires a valid KeyId in the request header. ```bash # Recherche simple sur le mot "expropriation" curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/search?query=expropriation" # Recherche avancée avec filtres multiples curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/search?query=responsabilit%C3%A9%20civile&operator=and&type=arret&chamber=civ1&publication=b&date_start=2020-01-01&date_end=2023-12-31&sort=date&order=desc&page_size=20&page=0&resolve_references=true" # Réponse attendue { "page": 0, "page_size": 20, "query": { "query": "responsabilité civile", "operator": "and", "type": ["arret"], "chamber": ["civ1"], "publication": ["b"], "date_start": "2020-01-01", "date_end": "2023-12-31", "sort": "date", "order": "desc" }, "total": 341, "next_page": "query=responsabilit%C3%A9%20civile&...&page=1", "took": 14, "max_score": 2428.1362, "relaxed": false, "results": [ { "score": 0.68, "highlights": { "motivations": ["...fragment avec responsabilité civile..."] }, "id": "5fca7d162a251e6bf9c78514", "jurisdiction": "Cour de cassation", "chamber": "Première chambre civile", "number": "20-15.123", "ecli": "ECLI:FR:CCASS:2021:C100456", "decision_date": "2021-06-15", "type": "Arrêt", "solution": "Cassation", "summary": "La responsabilité civile du propriétaire...", "themes": ["Responsabilité délictuelle", "Dommage"] } ] } ``` -------------------------------- ### Retrieve Chambers for a Specific Jurisdiction Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Get the list of chambers associated with a particular jurisdiction. This allows for more granular filtering of legal decisions. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/taxonomy?id=chamber&context_value=cc" ``` -------------------------------- ### Get Global Statistics Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Retrieve overall statistics for the Judilibre database, including indexed decisions and date ranges. Requires an API key. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/stats" ``` -------------------------------- ### Transactional History - Get Transactions Since Date Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Retrieve a history of write operations (create, update, delete) on the database since a specified date. Supports pagination. Requires an API key. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/transactionalhistory?date=2024-01-15T00:00:00Z&page_size=100" ``` -------------------------------- ### Get Full Label for a Taxonomy Key Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Retrieve the complete, human-readable label for a given taxonomy key (e.g., 'b' for 'Publié au Bulletin'). Useful for displaying full names to users. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/taxonomy?id=publication&key=b" ``` -------------------------------- ### Batch Export - GET /scan Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt The /scan endpoint allows for batch export of complete decisions, ideal for users who need to maintain their own databases. It uses Elasticsearch's `search_after` mechanism for efficient pagination without depth limits. ```APIDOC ## GET /scan ### Description Exports decisions in batches, suitable for bulk data retrieval and maintaining local databases. ### Method GET ### Endpoint /scan ### Query Parameters - **jurisdiction** (string) - Required - The jurisdiction code to filter decisions (e.g., 'cc' for Cour de cassation). - **batch_size** (integer) - Optional - The number of decisions to return per batch. Defaults to a reasonable value if not specified. - **date_start** (string) - Optional - The start date for filtering decisions (YYYY-MM-DD format). - **order** (string) - Optional - The sort order for the results ('asc' or 'desc'). - **search_after** (string) - Optional - A token used for paginating to the next batch of results. Obtained from the `next_batch` field of a previous response. ### Request Example ```bash # First batch export of Cour de cassation decisions curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/scan?jurisdiction=cc&batch_size=100&date_start=2023-01-01&order=asc" # Get the next batch using search_after curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/scan?jurisdiction=cc&batch_size=100&date_start=2023-01-01&order=asc&search_after=0%261704067200000%26673ded6f5559d27e30e40fc5" ``` ### Response #### Success Response (200) - **batch_size** (integer) - The number of items in the current batch. - **query** (object) - Details of the query parameters used for this request. - **total** (integer) - The total number of documents matching the query. - **next_batch** (string) - A token to retrieve the next batch of results. Empty if this is the last batch. - **took** (integer) - The time in milliseconds the search took. - **results** (array) - An array of decision objects. - Each decision object contains fields like `id`, `jurisdiction`, `chamber`, `number`, `decision_date`, `text`, `zones`, etc. #### Response Example ```json { "batch_size": 100, "query": { "jurisdiction": ["cc"], "date_start": "2023-01-01", "order": "asc", "batch_size": 100 }, "total": 25000, "next_batch": "date_start=2023-01-01&...&search_after=0%261704067200000%26673ded6f5559d27e30e40fc5", "took": 42, "results": [ { "id": "673ded6f5559d27e30e40fc5", "jurisdiction": "cc", "chamber": "civ1", "number": "22-10.456", "decision_date": "2023-01-05", "text": "[texte intégral de la décision]", "zones": {...} } ] } ``` ``` -------------------------------- ### Retrieve Full Decision - GET /decision Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Fetch the complete content of a specific court decision using its unique identifier. Includes full text, structured zones, metadata, and related documents. ```APIDOC ## GET /decision ### Description Allows retrieving the full content of a decision using its unique identifier. The response includes the complete text, structured zones, detailed metadata, associated documents, and jurisprudence cross-references. ### Method GET ### Endpoint /decision ### Query Parameters - **id** (string) - Required - The unique identifier of the decision. - **query** (string) - Optional - A search query to highlight terms within the decision text. - **operator** (string) - Optional - The logical operator for the query parameter (e.g., 'and', 'or'). - **resolve_references** (boolean) - Optional - Whether to resolve references within the decision. ### Request Example ```bash # Retrieve a decision by its ID curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/decision?id=5fca7d162a251e6bf9c78514&resolve_references=true" # Retrieve a decision with search term highlighting curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/decision?id=5fca7d162a251e6bf9c78514&query=expropriation&operator=and" ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the decision. - **jurisdiction** (string) - The jurisdiction that issued the decision. - **chamber** (string) - The chamber that issued the decision. - **number** (string) - The decision number. - **ecli** (string) - The European Case Law Identifier. - **decision_date** (string) - The date the decision was made (YYYY-MM-DD). - **type** (string) - The type of decision (e.g., 'Arrêt'). - **solution** (string) - The outcome of the decision (e.g., 'Cassation'). - **summary** (string) - A brief summary of the decision. - **themes** (array) - An array of themes associated with the decision. - **text** (string) - The full text of the decision. - **zones** (object) - Structured zones of the decision text (e.g., introduction, motivations, dispositif). - **metadata** (object) - Detailed metadata about the decision. - **references** (array) - Cross-references to other legal documents. #### Response Example ```json { "id": "5fca7d162a251e6bf9c78514", "jurisdiction": "Cour de cassation", "chamber": "Première chambre civile", "number": "20-15.123", "ecli": "ECLI:FR:CCASS:2021:C100456", "decision_date": "2021-06-15", "type": "Arrêt", "solution": "Cassation", "summary": "La responsabilité civile du propriétaire...", "themes": ["Responsabilité délictuelle", "Dommage"], "text": "Le présent arrêt concerne...", "zones": { "introduction": "...", "exposé_du_litige": "...", "moyens": "...", "motivations": "...", "dispositif": "..." }, "metadata": { "publication_status": "b", "keywords": ["responsabilité", "civile"] }, "references": [ { "type": "jurisprudence", "id": "..." } ] } ``` ``` -------------------------------- ### Search Decisions - GET /search Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Perform a full-text search within the legal decisions database. Supports numerous filters for jurisdiction, dates, keywords, and sorting options. Results are paginated. ```APIDOC ## GET /search ### Description Allows full-text search in the database of court decisions with numerous filters (jurisdiction, chamber, subject, type of ruling, dates, etc.). Results are paginated and sorted by relevance or date. ### Method GET ### Endpoint /search ### Query Parameters - **query** (string) - Required - The search query string. - **operator** (string) - Optional - The logical operator between query terms (e.g., 'and', 'or'). Defaults to 'or'. - **type** (string) - Optional - Type of decision to filter by (e.g., 'arret', 'ordonnance'). - **chamber** (string) - Optional - Chamber to filter by (e.g., 'civ1', 'soc'). - **publication** (string) - Optional - Publication status filter (e.g., 'b' for bulletin). - **date_start** (string) - Optional - Start date for filtering (YYYY-MM-DD). - **date_end** (string) - Optional - End date for filtering (YYYY-MM-DD). - **sort** (string) - Optional - Field to sort results by (e.g., 'date', 'score'). Defaults to 'score'. - **order** (string) - Optional - Order of sorting ('asc' or 'desc'). Defaults to 'desc'. - **page_size** (integer) - Optional - Number of results per page. Defaults to 20. - **page** (integer) - Optional - Page number for pagination. Defaults to 0. - **resolve_references** (boolean) - Optional - Whether to resolve references within decisions. ### Request Example ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/search?query=responsabilit%C3%A9%20civile&operator=and&type=arret&chamber=civ1&publication=b&date_start=2020-01-01&date_end=2023-12-31&sort=date&order=desc&page_size=20&page=0&resolve_references=true" ``` ### Response #### Success Response (200) - **page** (integer) - The current page number. - **page_size** (integer) - The number of results per page. - **query** (object) - The parameters used for the search query. - **total** (integer) - The total number of matching decisions. - **next_page** (string) - A token or URL to fetch the next page of results. - **took** (integer) - The time in milliseconds it took to execute the search. - **max_score** (float) - The maximum relevance score among the results. - **relaxed** (boolean) - Indicates if the search was relaxed. - **results** (array) - An array of decision objects. - **score** (float) - Relevance score of the decision. - **highlights** (object) - Snippets highlighting search terms. - **id** (string) - Unique identifier for the decision. - **jurisdiction** (string) - The jurisdiction that issued the decision. - **chamber** (string) - The chamber that issued the decision. - **number** (string) - The decision number. - **ecli** (string) - The European Case Law Identifier. - **decision_date** (string) - The date the decision was made (YYYY-MM-DD). - **type** (string) - The type of decision (e.g., 'Arrêt'). - **solution** (string) - The outcome of the decision (e.g., 'Cassation'). - **summary** (string) - A brief summary of the decision. - **themes** (array) - An array of themes associated with the decision. #### Response Example ```json { "page": 0, "page_size": 20, "query": { "query": "responsabilité civile", "operator": "and", "type": ["arret"], "chamber": ["civ1"], "publication": ["b"], "date_start": "2020-01-01", "date_end": "2023-12-31", "sort": "date", "order": "desc" }, "total": 341, "next_page": "query=responsabilit%C3%A9%20civile&...&page=1", "took": 14, "max_score": 2428.1362, "relaxed": false, "results": [ { "score": 0.68, "highlights": { "motivations": ["...fragment avec responsabilité civile..."] }, "id": "5fca7d162a251e6bf9c78514", "jurisdiction": "Cour de cassation", "chamber": "Première chambre civile", "number": "20-15.123", "ecli": "ECLI:FR:CCASS:2021:C100456", "decision_date": "2021-06-15", "type": "Arrêt", "solution": "Cassation", "summary": "La responsabilité civile du propriétaire...", "themes": ["Responsabilité délictuelle", "Dommage"] } ] } ``` ``` -------------------------------- ### Taxonomy and Referentials - GET /taxonomy Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt The /taxonomy endpoint allows you to retrieve lists of terms used in the API (jurisdictions, chambers, formations, publication levels, solutions, etc.). These referentials are essential for building search forms and interpreting results. ```APIDOC ## GET /taxonomy ### Description Retrieves lists of terms used in the API for filtering and interpretation. ### Method GET ### Endpoint /taxonomy ### Query Parameters - **id** (string) - Optional - Specifies the type of taxonomy to retrieve (e.g., 'jurisdiction', 'chamber', 'formation', 'publication', 'theme', 'solution', 'field'). If not provided, a list of available taxonomy IDs is returned. - **context_value** (string) - Optional - Filters the results based on a specific context, such as a jurisdiction code (e.g., 'cc' for Cour de cassation). - **key** (string) - Optional - Retrieves the detailed value for a specific taxonomy key within a given taxonomy ID. - **value** (string) - Optional - Performs a reverse lookup to find the key associated with a given taxonomy value (e.g., 'cour de cassation'). ### Request Example ```bash # List all available taxonomy entries curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/taxonomy" # Get the list of jurisdictions curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/taxonomy?id=jurisdiction" # Get chambers for a specific jurisdiction curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/taxonomy?id=chamber&context_value=cc" # Get the full label for a key curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/taxonomy?id=publication&key=b" # Reverse lookup: get key from value curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/taxonomy?id=jurisdiction&value=cour%20de%20cassation" ``` ### Response #### Success Response (200) - **id** (string) - The requested taxonomy ID. - **key** (string) - The requested taxonomy key (if applicable). - **value** (string) - The requested taxonomy value (if applicable). - **result** (object) - Contains the taxonomy data. This can be a list of IDs, a key-value map, or a specific result object. #### Response Example (List of jurisdictions) ```json { "id": "jurisdiction", "context_value": "cc", "result": { "cc": "Cour de cassation", "ca": "Cour d'appel", "tj": "Tribunal judiciaire", "tcom": "Tribunal de commerce" } } ``` #### Response Example (Specific key value) ```json { "id": "publication", "key": "b", "result": {"value": "Publié au Bulletin"} } ``` ``` -------------------------------- ### Reverse Lookup: Get Key from Taxonomy Value Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Find the taxonomy key corresponding to a given value (e.g., 'Cour de cassation'). This is useful when you have a display name and need to find its internal key for API calls. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/taxonomy?id=jurisdiction&value=cour%20de%20cassation" ``` -------------------------------- ### Lancement de l'API avec Docker Source: https://github.com/cour-de-cassation/judilibre-search/blob/dev/README.md Commande pour exécuter une instance de l'API avec une version mockée d'Elasticsearch. ```bash docker run --env WITHOUT_ELASTIC=true -p 80:8080/tcp opendatajustice/judilibre-search:master ``` -------------------------------- ### Initial Batch Export of Decisions Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Perform the first export of legal decisions from a specific jurisdiction within a date range. This sets up the pagination for subsequent requests using the 'next_batch' cursor. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/scan?jurisdiction=cc&batch_size=100&date_start=2023-01-01&order=asc" ``` -------------------------------- ### Retrieve Next Batch of Decisions using Search After Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Fetch the subsequent batch of legal decisions by providing the 'search_after' parameter obtained from the previous response. This enables deep pagination without performance degradation. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/scan?jurisdiction=cc&batch_size=100&date_start=2023-01-01&order=asc&search_after=0%261704067200000%26673ded6f5559d27e30e40fc5" ``` -------------------------------- ### Linéarisation des zones de décision en JavaScript Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Cette fonction trie les fragments de texte par position et les extrait pour un affichage séquentiel. Nécessite un objet décision contenant les propriétés 'text' et 'zones'. ```javascript // Linéarisation des zones pour un affichage séquentiel function linearizeZones(decision) { const text = decision.text; const zones = decision.zones; const orderedZones = []; for (let zone in zones) { zones[zone].forEach((fragment) => { orderedZones.push({ zone: zone, start: fragment.start, end: fragment.end }); }); } // Tri par position de début orderedZones.sort((a, b) => a.start - b.start); // Extraction du texte par zone return orderedZones.map((z) => ({ zone: z.zone, content: text.substring(z.start, z.end) })); } // Exemple d'utilisation const decision = await fetch(`${API_URL}/decision?id=xxx`).then(r => r.json()); const zonesLineaires = linearizeZones(decision); zonesLineaires.forEach(({zone, content}) => { console.log(`=== ${zone.toUpperCase()} ===`); console.log(content); }); ``` -------------------------------- ### Linéarisation des zones en JavaScript Source: https://github.com/cour-de-cassation/judilibre-search/blob/dev/README.md Algorithme pour ordonner séquentiellement les fragments de texte d'une décision en fonction de leurs indices de début. ```javascript const text = result.text; const zones = result.zones; const orderedZones = []; for (let zone in zones) { zones[zone].forEach((fragment) => { orderedZones.push({ zone: zone, start: fragment.start, end: fragment.end, }); }); } orderedZones.sort((a, b) => { if (a.start < b.start) { return -1; } if (a.start > b.start) { return 1; } return 0; }); // La liste orderedZones contient désormais les zones ordonnées séquentiellement : orderedZones.forEach((zone) => { const textFragment = text.substring(zone.start, zone.end); console.log(`Zone: ${zone.zone}`); console.log(`Fragment: ${textFragment}`); }); ``` -------------------------------- ### Export Data (Abridged) Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Use this endpoint to export data from Judilibre in an abridged format, without the full text. Requires an API key. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/scan?jurisdiction=ca&abridged=true&batch_size=500" ``` -------------------------------- ### Réponse JSON de l'API Source: https://github.com/cour-de-cassation/judilibre-search/blob/dev/README.md Exemple de structure de réponse retournée par l'endpoint de recherche. ```json {"page":0,"page_size":10,"query":{"query":"brevet","field":[],"type":[],"theme":[],"chamber":[],"formation":[],"jurisdiction":[],"publication":[],"solution":[]},"total":2025,"previous_page":null,"next_page":"query=brevet&field=&type=&theme=&chamber=&formation=&jurisdiction=&publication=&solution=&page=1","took":25,"max_score":2934.1016,"results":[{"score":1,"highlights":{"text":["européen et d'un brevet français se résout par la substitution du brevet...} ``` -------------------------------- ### Structure de l'objet zones Source: https://github.com/cour-de-cassation/judilibre-search/blob/dev/README.md Représentation JSON de l'objet zones contenant les indices de début et de fin pour chaque section de la décision. ```json { "zones": { "introduction": [ { "start": 0, "end": 1649 } ], "expose": [ { "start": 1649, "end": 2204 } ], "moyens": [ { "start": 2204, "end": 4753 } ], "motivations": [ { "start": 4753, "end": 7543 } ], "dispositif": [ { "start": 7543, "end": 7924 } ], "annexes": [ { "start": 7924, "end": 45372 } ] } } ``` -------------------------------- ### Node.js Script for Syncing Deletions Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt A Node.js script using axios to fetch transactional history and identify deleted records. It requires an API key set as an environment variable. ```javascript const axios = require("axios"); const querystring = require("querystring"); const JUDILIBRE_API_URL = "https://api.piste.gouv.fr/cassation/judilibre/v1.0"; const YESTERDAY = new Date(Date.now() - 24 * 60 * 60 * 1000); async function getTransactionalHistory(query) { const response = await axios.get(`${JUDILIBRE_API_URL}/transactionalhistory?${query}`, { headers: { "KeyId": process.env.API_KEY } }); return response.data; } async function getAllHistory(query) { if (!query) return []; const { transactions, next_page } = await getTransactionalHistory(query); return [...transactions, ...(await getAllHistory(next_page))]; } async function syncDeletions() { const transactions = await getAllHistory(querystring.stringify({ date: YESTERDAY.toISOString() })); const deletions = transactions.filter(t => t.action === "deleted"); for (const deletion of deletions) { console.log(`Suppression détectée: ${deletion.id} à ${deletion.date}`); // await maBaseDeDonnees.supprimer(deletion.id); } } syncDeletions().catch(console.error); ``` -------------------------------- ### Statistics API Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt The `/stats` endpoint provides statistics on the Judilibre database content, including the number of indexed decisions, extreme dates, and aggregations by various dimensions. ```APIDOC ## GET /stats ### Description Provides statistics on the Judilibre database content, including indexed decisions, extreme dates, and aggregations. ### Method GET ### Endpoint /stats ### Query Parameters - **jurisdiction** (string) - Optional - Filters statistics by a specific jurisdiction (e.g., "ca"). - **keys** (string) - Optional - Comma-separated list of dimensions to aggregate by (e.g., "jurisdiction,year"). ### Request Example ```bash # Global statistics curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/stats" # Statistics by jurisdiction and year curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/stats?keys=jurisdiction,year" # Statistics for appellate courts only curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/stats?jurisdiction=ca&keys=location,year" ``` ### Response #### Success Response (200) - **query** (object) - The query parameters used. - **results** (object) - Contains the statistical results. - **total_decisions** (integer) - Total number of decisions indexed. - **min_decision_date** (string) - The earliest decision date. - **max_decision_date** (string) - The latest decision date. - **aggregated_data** (array) - An array of aggregated statistics based on the `keys` parameter. - **key** (object) - The key for the aggregation (e.g., year, location). - **decisions_count** (integer) - The number of decisions for this key. #### Response Example ```json { "query": { "jurisdiction": "ca", "keys": "location,year" }, "results": { "total_decisions": 1250000, "min_decision_date": "1970-10-01", "max_decision_date": "2024-02-15", "aggregated_data": [ {"key": {"year": "2024", "location": "ca_paris"}, "decisions_count": 5470}, {"key": {"year": "2024", "location": "ca_rennes"}, "decisions_count": 2210}, {"key": {"year": "2023", "location": "ca_paris"}, "decisions_count": 12350} ] } } ``` ``` -------------------------------- ### Retrieve Jurisdictions Taxonomy Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt Fetch the list of jurisdictions supported by the API. This is useful for populating dropdowns or validating user input for jurisdiction fields. ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/taxonomy?id=jurisdiction" ``` -------------------------------- ### Export with Abridged Version (without full text) Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt This endpoint allows exporting data from the Judilibre database with an abridged version, excluding the full text of decisions. It requires specifying the jurisdiction and can be configured with batch size for pagination. ```APIDOC ## GET /scan ### Description Exports data from the Judilibre database with an abridged version (without full text). ### Method GET ### Endpoint /scan ### Query Parameters - **jurisdiction** (string) - Required - The jurisdiction to filter by (e.g., "ca"). - **abridged** (boolean) - Required - Set to `true` to get the abridged version. - **batch_size** (integer) - Optional - The number of records to return per batch. ### Request Example ```bash curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/scan?jurisdiction=ca&abridged=true&batch_size=500" ``` ``` -------------------------------- ### Transactional History API Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt The `/transactionalhistory` endpoint allows tracking write operations (creation, update, deletion) on the database, essential for keeping the Judilibre base synchronized. ```APIDOC ## GET /transactionalhistory ### Description Tracks write operations (creation, update, deletion) performed on the database. Essential for keeping the Judilibre base synchronized. ### Method GET ### Endpoint /transactionalhistory ### Query Parameters - **date** (string) - Required - The starting date for retrieving transactions (ISO 8601 format). - **page_size** (integer) - Optional - The number of transactions to return per page. - **from_id** (string) - Optional - Used for pagination to retrieve subsequent pages. ### Request Example ```bash # Retrieve transactions since a specific date curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/transactionalhistory?date=2024-01-15T00:00:00Z&page_size=100" ``` ### Response #### Success Response (200) - **transactions** (array) - A list of transaction objects. - **id** (string) - The unique identifier for the transaction. - **action** (string) - The type of action performed (e.g., "created", "updated", "deleted"). - **date** (string) - The timestamp of the transaction. - **next_page** (string) - A token or URL for fetching the next page of results. - **page_size** (integer) - The number of transactions returned in this response. - **total** (integer) - The total number of transactions available. - **query_date** (string) - The date and time the query was processed. #### Response Example ```json { "transactions": [ {"id": "673ded6e5559d27e30e40f67", "action": "created", "date": "2024-01-15T14:50:10.185Z"}, {"id": "673ded6e5559d27e30e40f69", "action": "updated", "date": "2024-01-15T15:20:30.000Z"}, {"id": "673ded6f5559d27e30e40f6b", "action": "deleted", "date": "2024-01-15T16:00:00.000Z"} ], "next_page": "date=2024-01-15T00:00:00Z&page_size=100&from_id=1705329610185%2699", "page_size": 100, "total": 834, "query_date": "2024-01-31T08:10:18.262Z" } ``` ### Node.js Synchronization Script Example ```javascript const axios = require("axios"); const querystring = require("querystring"); const JUDILIBRE_API_URL = "https://api.piste.gouv.fr/cassation/judilibre/v1.0"; const YESTERDAY = new Date(Date.now() - 24 * 60 * 60 * 1000); async function getTransactionalHistory(query) { const response = await axios.get(`${JUDILIBRE_API_URL}/transactionalhistory?${query}`, { headers: { "KeyId": process.env.API_KEY } }); return response.data; } async function getAllHistory(query) { if (!query) return []; const { transactions, next_page } = await getTransactionalHistory(query); return [...transactions, ...(await getAllHistory(next_page))]; } async function syncDeletions() { const transactions = await getAllHistory(querystring.stringify({ date: YESTERDAY.toISOString() })); const deletions = transactions.filter(t => t.action === "deleted"); for (const deletion of deletions) { console.log(`Suppression détectée: ${deletion.id} à ${deletion.date}`); // await maBaseDeDonnees.supprimer(deletion.id); } } syncDeletions().catch(console.error); ``` ``` -------------------------------- ### Health Check API Source: https://context7.com/cour-de-cassation/judilibre-search/llms.txt The `/healthcheck` endpoint is used to verify the availability status of the API service. ```APIDOC ## GET /healthcheck ### Description Checks the availability status of the API service. ### Method GET ### Endpoint /healthcheck ### Request Example ```bash # Check service availability curl -H "accept: application/json" \ -H "KeyId: VOTRE_CLE_API" \ -X GET "https://api.piste.gouv.fr/cassation/judilibre/v1.0/healthcheck" ``` ### Response #### Success Response (200) - **status** (string) - The status of the service (e.g., "disponible", "indisponible"). #### Response Example ```json {"status": "disponible"} ``` #### Unavailable Response Example ```json {"status": "indisponible"} ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.