Files

As the name suggests, files are a core part of House Check. On this page, we'll dive into the different file endpoints you can use to manage files programmatically. We'll look at how to query and create files.

The file model

The file model contains all the information about your files.

Properties

  • Name
    model_id
    Type
    string
    Description

    Id of the model you want to upload a file for.

  • Name
    model_type
    Type
    string
    Description

    Type of model. Must be one of the following:

    order add a file to an order.

  • Name
    collection_name
    Type
    string
    Description

    Name of the collection you want to add a file. Must be one of the following:

    clientFiles add a file to the client files.

  • Name
    files[]
    Type
    files
    Description

    The file itself.


POST/api/files

Upload a file

This endpoint allows you to add a new file to your organisation in House Check.

To add a file, you must provide the above mentioned properties.

You can upload one or more files at once. Please note that the files[] property has [] in its name

Request

POST
/api/files
curl --location 'https://housecheck.be/api/files/' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--form 'model_id="9000"' \
--form 'model_type="order"' \
--form 'collection_name="clientFiles"' \
--form 'files[]=@"/Users/aron/myfile.pdf"'

Response 201

{
  "id": 123,
}

GET/api/files/:id

Retrieve a file

This endpoint allows you to retrieve a file by providing the file id.

Request

GET
/api/files/2
curl https://housecheck.be/api/files/2 \
  -H "Authorization: Bearer {token}"

Response 200

---The file---