Document API Endpoints - TodoLegal/TodoLegal GitHub Wiki

Get Document

GET /documents/[ID]

Example

curl -H "Content-Type:application/json" -X GET https://test.todolegal.app/api/v1/documents/15

Response

Name Type Notes
document Document Object
related_documents Document Object Array
{
  "document": {
    "id": 364,
    "name": "DE-PCM-098-2020",
    "created_at": "2020-12-27T10:43:11.630Z",
    "updated_at": "2020-12-27T10:43:11.653Z",
    "url": "364-de-pcm-098-2020-35-395",
    "publication_date": "2020-10-09",
    "publication_number": "35,395",
    "description": "Autorizar a la Secretaría de Estado en el Despa...",
    "file": "https://test.todolegal.app/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBajhCIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--3978e6272d3f134c1f2b981efbf8ee8cfe1193fb/file.pdf"
  },
  "tags": [
    {
      "name": "Decreto Ejecutivo",
      "type": "creacion"
    }
  ],
  "related_documents": [
    {
      "id": 364,
      "name": "DE-PCM-098-2020",
      "created_at": "2020-12-27T10:43:11.630Z",
      "updated_at": "2020-12-27T10:43:11.653Z",
      "url": "364-de-pcm-098-2020-35-395",
      "publication_date": "2020-10-09",
      "publication_number": "35,395",
      "description": "Autorizar a la Secretaría de Estado en el Despa..."
    },
    {
      "id": 365,
      "name": "DE-PCM-099-2020",
      "created_at": "2020-12-27T10:43:12.952Z",
      "updated_at": "2020-12-27T10:43:12.974Z",
      "url": "365-de-pcm-099-2020-35-395",
      "publication_date": "2020-10-09",
      "publication_number": "35,395",
      "description": "ARTÍCULO 1. Crear el Gabinete Especial para la ..."
    }
  ]
}

Get All Documents

GET /documents

Example

curl -H "Content-Type:application/json" -X GET "https://test.todolegal.app/api/v1/documents?query=estado"
curl -H "Content-Type:application/json" -X GET "https://test.todolegal.app/api/v1/documents?query=estado&from=2020-10-07&to=2020-10-09"

URL Parameters

Name Type Notes
query string Full text search
offset integer Use with limit to paginate results
limit integer Use with offset to paginate results
from date Return only documents where publication_date is greater or equal
to date Return only documents where publication_date is lesser or equal

Response

Name Type Notes
documents Document Object Array
count int Amount of document objects returned, ignores limit and offset
{
  "documents": [
    {
      "id": 364,
      "name": "DE-PCM-098-2020",
      "created_at": "2020-12-27T10:43:11.630Z",
      "updated_at": "2020-12-27T10:43:11.653Z",
      "url": "364-de-pcm-098-2020-35-395",
      "publication_date": "2020-10-09",
      "publication_number": "35,395",
      "description": "Autorizar a la Secretaría de Estado en el Despa..."
    },
    {
      "id": 342,
      "name": "DE-PCM-095-2020",
      "created_at": "2020-12-27T10:42:22.846Z",
      "updated_at": "2020-12-27T10:42:22.867Z",
      "url": "342-de-pcm-095-2020-35-393",
      "publication_date": "2020-10-07",
      "publication_number": "35,393",
      "description": "Declarar estado de emergencia en los departamen..."
    }
  ],
  "count":2
}