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(s) being uploaded to the tenant.

Validations:

  • Must be a String

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/0719266b-5601-490a-a4df-22d0f5860d6b/tenants/290efa6d-26b5-4b9a-be33-9199541cb2bd/attachments
Content-Type: multipart/form-data; boundary=APIPIE_RECORDER_EXAMPLE_BOUNDARY

--APIPIE_RECORDER_EXAMPLE_BOUNDARY
Content-Disposition: form-data; name="attachments[]"

#<ActionDispatch::Http::UploadedFile:0x000000010f4db358>
--APIPIE_RECORDER_EXAMPLE_BOUNDARY
Content-Disposition: form-data; name="attachments[]"

#<ActionDispatch::Http::UploadedFile:0x000000010f4db1a0>
--APIPIE_RECORDER_EXAMPLE_BOUNDARY
Content-Disposition: form-data; name="file_type"
Content-Length: 2

10
--APIPIE_RECORDER_EXAMPLE_BOUNDARY
Content-Disposition: form-data; name="primary"
Content-Length: 8

logo.png
--APIPIE_RECORDER_EXAMPLE_BOUNDARY--
200
{
  "attachments": [
    {
      "id": 40,
      "tenant_id": null,
      "document": {
        "url": "http://test.host/uploads/attachment/document/40/test_battery.pdf",
        "thumb": {
          "url": null
        }
      },
      "attachable_id": 2606,
      "attachable_type": "Tenant",
      "created_at": "2024-05-10T09:25:15.571-10:00",
      "updated_at": "2024-05-10T09:25:15.571-10:00",
      "user_id": null,
      "file_type": 10,
      "primary": null,
      "original_file_name": "battery.pdf",
      "facility_id": 3574,
      "event_id": null,
      "created_by_type": "ClientApplication",
      "created_by_id": 3085
    },
    {
      "id": 39,
      "tenant_id": null,
      "document": {
        "url": "http://test.host/uploads/attachment/document/39/test_logo.jpg",
        "thumb": {
          "url": "http://test.host/uploads/attachment/document/39/thumb_test_logo.jpg"
        }
      },
      "attachable_id": 2606,
      "attachable_type": "Tenant",
      "created_at": "2024-05-10T09:25:14.953-10:00",
      "updated_at": "2024-05-10T09:25:15.683-10:00",
      "user_id": null,
      "file_type": 10,
      "primary": true,
      "original_file_name": "logo.png",
      "facility_id": 3574,
      "event_id": null,
      "created_by_type": "ClientApplication",
      "created_by_id": 3085
    }
  ],
  "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",
      "primary": "logo.png",
      "facility_id": "0719266b-5601-490a-a4df-22d0f5860d6b",
      "tenant_id": "290efa6d-26b5-4b9a-be33-9199541cb2bd"
    }
  }
}