Simple file upload

This page describes how to upload files, so you can use them later for other purposes.

Introduction

Please use this endpoint only if you don't want to automatically link the files to properties, units, tenants. For example this endpoint could be used for:

  • creating a listing via API (currently only possible with restricted access and not yet documented)

  • updating a user profile image via API

  • submit candidate / applicant information, with files via API (currently only possible with restricted access and not yet documented)

Endpoints

Upload a file

GET https://{custom_subdomain}.everreal.co/api/file-storage/company/files

Request Body

Name
Type
Description

file*

Form file

The file

resourcePath*

String

The virtual folder path

name

String

Override the display name of the file

Delete a file

DELETE https://{custom_subdomain}.everreal.co/api/file-storagecompany/files?resourcePath={uploadedResourcePath}

Example flow for creating a listing

  • upload image1.jpeg , image2.jpeg , floorPlan.pdf

  • pass the responses to the create listing payload

Step 1 - upload images

// Do this for every image
const myHeaders = new Headers();
myHeaders.append('Accept', 'application/json');
myHeaders.append(
  'Authorization',
  'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwZTY1Y2ViYi1lNDI4LTQ4YTktOTY4MS03NmRkYTM0ZDIyOTkiLCJzdWIiOiJkNWY4ZmI5My1kYTIxLTQwNTktYjhjOC0wN2M0MjE0OTczMTkiLCJleHAiOjE2ODUwMTAyMjEsImlhdCI6MTY4NTAwNjYyMX0.byF0tReLQOYRXwvgssQG1HFfrxWOPm1WdA4ZcLyJMX6LDxg586pjebiyBtE7cJvFAHhDxIdXGlp6LLDs-HaGmk10H-HMmRdLG4gHzs-QRz4goQIVgUv3kikG5YseXMgqmRCssXtBVbo-XjS_bHFSLkMV5zNESByliYLFJReXXpQTC_LP3PUdA7qvnL4PZAwbcoa6aPKyPtuur9gCXvcVDgvFdzQQ5WMnr9u0CiXMeqk3ybAMUTD9RdXYBpTDoJChemFDq0E1-GYDBbC-WuwOsw5sYPokCjuD-7ARsm6UaBxNExJWYUz5erpVhewNZHiGhOyUqARomV8QcbatiL-RNw',
);

const formdata = new FormData();
formdata.append('file', fileInput, { filename: 'Living Room', contentType: 'image/png' });
formdata.append('resourcePath', 'listings/117ff3a1-6f1b-4da8-a3da-208d2e6f5ac4/pictures');
formdata.append('name', 'Floor plans');

const requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow',
};

fetch('https://{subdomain}.everreal.co/api/file-storage/company/files', requestOptions)
  .then((response) => response.json())
  .then((result) => console.log(result))
  .catch((error) => console.log('error', error));

Response will be something like

{
    "name": "Floor plans",
    "resourcePath": "subdomain/116aeae1-615a-11e7-97db-257f422c12345/listings/117ff3a1-6f1b-4da8-a3da-208d2e6f5ac4/pictures",
    "size": 389417,
    "type": "image/png"
}

Step 2 - pass payload during create listing

const body = {
   /// other data
   pictures: [{
      ...responsePicture1,
      order: 0,
   }, {
      ...responsePicture2,
      order: 1,
   }],
   floorPlans: [{
      ...responseFloorPlanPdf,
      order: 0
   }]
};

const requestOptions = {
  method: 'POST',
  headers: {....},
  body
};

fetch('https://{subdomain}.everreal.co/api/create-listing-endpoint', requestOptions)
  .then((response) => response.json())
  .then((result) => console.log(result))
  .catch((error) => console.log('error', error));

Last updated