Discussion

API for uploading multiple files/attachments to a tenant's records

Allowed values for file_type

  • 10 - driver's license
  • 20 - lease agreement
  • 30 - miscellaneous
  • 40 - property damage
  • 50 - tenant id
  • 60 - unit damage
  • 70 - vehicle
  • 80 - insurance
  • 90 - address change
  • 100 - returned mail
  • 110 - disposal sale
  • 120 - delinquency
  • 130 - import

POST /v1/:facility_id/tenants/:tenant_id/attachments
Create (Upload) a file/attachment for an associated tenant

Params

Param name Description
facility_id
required

The UUID for the facility.

Validations:

  • Must be a UUID

tenant_id
required

The UUID for the tenant.

Validations:

  • Must be a UUID

attachments
required

The attachments being uploaded to the tenant, with a maximum of 10 attachments per request and 10 MB per attachment.

Validations:

  • Must be an array of any type

file_type
required

The attachment type of the file/files being uploaded to the tenant.

Validations:

  • Must be a String

user_id
required

The UUID of the user adding attachments to the tenant.

Validations:

  • Must be a UUID

primary
optional

The name of the file - including its extension - to be set as the primary attachment for the tenant.

Validations:

  • Must be a String

Examples

POST /v1/842b68bf-1626-4399-b979-3f3d1514b9bf/tenants/d3079be3-18c8-4bf0-b0f6-0062d1f4c38d/attachments
{
  "attachments": [
    "#<ActionDispatch::Http::UploadedFile:0x00007fb803f240c8>",
    "#<ActionDispatch::Http::UploadedFile:0x00007fb803f2ff90>"
  ],
  "file_type": "10",
  "user_id": "6706e1f0-2f24-48de-b3d3-368df2761fa9",
  "primary": "logo.png"
}
200
{
  "attachments": [
    {
      "id": 475,
      "tenant_id": null,
      "document": {
        "url": "http://test.host/uploads/attachment/document/475/test_battery.pdf",
        "thumb": {
          "url": null
        }
      },
      "attachable_id": 2413,
      "attachable_type": "Tenant",
      "created_at": "2024-03-26T05:46:53.852-10:00",
      "updated_at": "2024-03-26T05:46:53.852-10:00",
      "user_id": 3140,
      "file_type": 10,
      "primary": null,
      "original_file_name": "battery.pdf",
      "facility_id": 2750,
      "event_id": null
    },
    {
      "id": 474,
      "tenant_id": null,
      "document": {
        "url": "http://test.host/uploads/attachment/document/474/test_logo.jpg",
        "thumb": {
          "url": "http://test.host/uploads/attachment/document/474/thumb_test_logo.jpg"
        }
      },
      "attachable_id": 2413,
      "attachable_type": "Tenant",
      "created_at": "2024-03-26T05:46:53.558-10:00",
      "updated_at": "2024-03-26T05:46:53.920-10:00",
      "user_id": 3140,
      "file_type": 10,
      "primary": true,
      "original_file_name": "logo.png",
      "facility_id": 2750,
      "event_id": null
    }
  ],
  "meta": {
    "status_code": 200,
    "status_message": "OK",
    "status_cat": "https://http.cat/200",
    "request_method": "POST",
    "request_id": null,
    "parameters": {
      "attachments": [
        {
          "original_filename": "logo.png",
          "content_type": "text/plain"
        },
        {
          "original_filename": "battery.pdf",
          "content_type": "text/plain"
        }
      ],
      "file_type": "10",
      "user_id": "6706e1f0-2f24-48de-b3d3-368df2761fa9",
      "primary": "logo.png",
      "facility_id": "842b68bf-1626-4399-b979-3f3d1514b9bf",
      "tenant_id": "d3079be3-18c8-4bf0-b0f6-0062d1f4c38d"
    }
  }
}