Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

API.Routes.DatEdit

Mestre-Tramador edited this page Sep 9, 2022 · 1 revision

Edit Dat PUT

/dat/:id

Update a stored .dat file with a new one.

URL Path

Path Value Description
:id number The numeric ID of the .dat file being read.

Headers

Name Value Description
Content-Type multipart/form-data As a files are required, a FormData shall be sent.

Request Body

The only mandatory specification is that the first and only sent file must be a Dat file.

Response

200

{
  "id": 18,
  "name": "18.dat",
  "first_read": "2022-08-12 14:30:21",
  "last_read": "2022-09-12 15:15:47",
  "user": {
    "id": 1,
    "name": "Exper Admin"
  },
  "data": {
    "sellers": [
      {
        "cpf": "736.936.580-80",
        "name": "Gabriel Lasques",
        "wage": 1550.0
      }
    ],
    "customers": [
      {
        "cnpj": "46.959.517/0001-03",
        "name": "Heitor Macedo",
        "branch": "Imóveis"
      },
      {
        "cnpj": "95.230.773/0001-70",
        "name": "Érica Fraga",
        "branch": "Roupas"
      }
    ],
    "sales": [
      {
        "id": 742,
        "items": [
          {
            "id": 65328,
            "quantity": 5,
            "price": 17.5
          },
          {
            "id": 65347,
            "quantity": 2,
            "price": 39.99
          }
        ],
        "seller": "Gabriel Lasques"
      }
    ]
  }
}

The successful result merge the basic information present no the List route, namely the id, name, first_read, last_read, user with the one present on the Read route in the data key.

404

{
  "error": "File not found"
}

If there is no file with the given ID, then this error is returned.

422

{
  "error": "Invalid file"
}

If the .dat file somehow is invalid or not on the pattern of the application, this error is returned.

Clone this wiki locally