# Listing

{% hint style="warning" %}
To use EverReal playground is required to provide the Bearer token, read more in Master Data page
{% endhint %}

### Important information

#### Amenities

Parking can have 2 values:

* `null` if the listing does not have amenity "Has Parking" checked
* `{type, quality}` if the listing has amenity "Has Parking" checked

**Pictures and documents**

There are 4 important document properties: `{coverPicture,pictures,documents,floorPlans}`&#x20;

The base path of pictures is formed of the `baseUrl + "/" picture.resourcePath` .The base url is [https://resources.everreal.co](#graphql)

### Query

To understand what is necessary and how to use GraphQl, in Master Data page we explain what is necessary to do

{% content-ref url="../how-to-guide/everreal-data-import-process/master-data" %}
[master-data](https://api-docs.everreal.co/how-to-guide/everreal-data-import-process/master-data)
{% endcontent-ref %}

```graphql
type Query {
  listings(input: ListingFilterListPaging): [Listing]
  avgListingActivity(input: AvgActivityFilter): AvgListingActivity
  listingCounts(input: ListingCountsFilter): ListingCounts
}

type AvgListingActivity {
  activeListings: Int
}

type ListingCounts {
  listingsMissingViewings: Int
  listingsMissingContracts: Int
  activeAndPublished: Int
  olderThan30Days: Int
  listingsInContracting: Int
  listingsContractingCompleted: Int
  listingsMoveinCompleted: Int
}

type Listing {
  id: String
  title: String
  type: String
  isArchived: Boolean
  isActive: Boolean
  companyId: String
  listingResponsible: User
  contractDetails: ListingContractDetails
  coverPicture: IFile
  pictures: [IFile]
  documents: [IFile]
  floorplans: [IFile]
  company: Company
  status: LISTING_STATUS
  amenities: ListingAmenities
  listingInformation: ListingInformation
  availableFrom: Date
  propertyId: String
  property: Property
  unitId: String
  unit: Unit
  descriptions: ListingDescription
  createdAt: DateTime
  updatedAt: DateTime
}

type ListingAmenities {
  amenitiesIncluded: [AMENITIES_INCLUDED] # See this type under units page
  parking: UnitParkingType # See this type under units page
  qualityOfAmenities: String
  condition: String
  lastRenovationYear: Int
  heatingType: String
  mainEnergySource: String
  energyPerformanceCertificateAvailability: ENERGY_PERFORMANCE_CERTIFICATE_AVAILABILITY
  energyCertificateCreationDate: ENERGY_CERTIFICATE_CREATION_DATE
  buildingEnergyRatingType: BUILDING_ENERGY_RATING_TYPE
  thermalCharacteristic: Float
  energyConsumptionContainsWarmWater: Boolean
  energyEfficiencyClass: ENERGY_EFFICIENCY_CLASS
}

type ListingDescription {
  object: String
  amenities: String
  location: String
  other: String
}

type ListingContractDetails {
  currency: String
  rent: Float
  totalMonthlyRent: Float
  parkingRent: Float
  deposit: Float
  heatingCostsIncluded: Boolean
  utilityCosts: Float
  heatingCosts: Float
  petsAllowed: String
  displayAmount: Float
  hasCommission: Boolean
  commission: String
  commissionNote: String
  commissionType: String
}

enum UNIT_TYPE {
  APARTMENT
  HOUSE
  PARKING
  OFFICE
  STORE
  GASTRONOMY
  INDUSTRY
  SPECIAL_PURPOSE
  LAN
}

enum LISTING_TYPE {
  RENT_APARTMENT
  SELL_APARTMENT
  RENT_SHORT_TERM_APARTMENT
  RENT_HOUSE
  SELL_HOUSE
  RENT_PARKING
  SELL_PARKING
  RENT_RESIDENTIAL_LAND
  SELL_RESIDENTIAL_LAND
  RENT_OFFICE
  SELL_OFFICE
  RENT_STORE
  SELL_STORE
  RENT_GASTRONOMY
  SELL_GASTRONOMY
  RENT_INDUSTRY
  SELL_INDUSTRY
  RENT_SPECIAL_PURPOSE
  SELL_SPECIAL_PURPOSE
  RENT_COMMERCIAL_LAND
  SELL_COMMERCIAL_LAND
}

enum LISTING_STATUS {
  OPEN_FOR_CANDIDATES
  OPEN_FOR_APPLICANTS
  CONTRACTING_STARTED
  CONTRACTING_COMPLETED
  MOVE_IN_COMPLETED
  IS_INACTIVE
  IS_ARCHIVED
}

enum CANDIDATE_SOURCE {
  APPLIED_EVERREAL
  MANUAL_EVERREAL_CANDIDATE
  MANUAL_EVERREAL_SCHEDULED
  MANUAL_EVERREAL_APPLICANT
  IMMOSCOUT24
  WG_GESUCHT
  IMMOWELT
  IMMONET
  IVD24
  NWZ
  OPENIMMO_GENERIC
  EBAY
  OFFLINE_CONTRACT
}

input ListingFilter {
  from: Date
  to: Date
  candidateSources: [CANDIDATE_SOURCE]
  companyId: String
  propertyGroupId: String
  propertyId: String
  ownerId: String
  listingId: String
  external: Boolean
  fullSearch: String
  isArchived: Boolean
  isActive: Boolean
  internalAdvertiseId: String
  availableFrom: Date
  externalPropertyId: String
  scoringTemplateId: String
  propertyCity: String
  propertyName: String
  propertyStreet: String
  listingType: LISTING_TYPE
  status: LISTING_STATUS
  responsibleFullName: String
  unitName: String
  unitId: String
  externalUnitId: String
  unitType: UNIT_TYPE
  priceMin: Float
  priceMax: Float
  roomsMin: Int
  roomsMax: Int
  surfaceMin: Int
  surfaceMax: Int
  livingSurfaceMin: Int
  livingSurfaceMax: Int
  heightMax: Int
  heightMin: Int
  listingResponsibleUserId: String
  projectId: String
  candidateEmail: String
  candidateIsWinner: Boolean
}

input ListingFilterListPaging {
  filter: ListingFilter
  paging: GraphPaging
  sort: GraphSorting
}

input ListingCountsFilter {
  userId: String
  companyId: String
}

```

Usage:

{% tabs %}
{% tab title="GraphQL" %}
**Query:**

```graphql
  query listingsQuery(
    $from: Date
    $to: Date
    $companyId: String
    $propertyId: String
    $propertyGroupId: String
    $ownerId: String
    $listingId: String
    $isArchived: Boolean
    $isActive: Boolean
    $fullSearch: String
  ) {
    listings(
      input: {
        paging: { take: 100, skip: 0 }
        filter: {
          from: $from
          to: $to
          companyId: $companyId
          propertyGroupId: $propertyGroupId
          propertyId: $propertyId
          ownerId: $ownerId
          listingId: $listingId
          isArchived: $isArchived
          isActive: $isActive
          fullSearch: $fullSearch
        }
      }
    ) {
      id
      title
      type
      isArchived
      isActive
      companyId
      amenities{
        amenitiesIncluded
        qualityOfAmenities
        parking {type quantity}
        energyPerformanceCertificateAvailability
        energyCertificateCreationDate
        buildingEnergyRatingType
        thermalCharacteristic
        energyConsumptionContainsWarmWater
        energyEfficiencyClass
      }
      coverPicture {
        name
        resourceId
        resourcePath
        size
        type
        order
        isCoverPicture
      }
      pictures  {
        name
        resourceId
        resourcePath
        size
        type
        order
        isCoverPicture
      }
      documents   {
        name
        resourceId
        resourcePath
        size
        type
        order
        isCoverPicture
      }
      floorplans  {
        name
        resourceId
        resourcePath
        size
        type
        order
        isCoverPicture
      }
      property {
        objectId
        name
        category
        subtype
        type
        ownershipType
        fullAddress
      }
      unit {
        id
        objectId
        name
        category
        type
        subtype
        leasingStatusEnum
        leasingStatusesEnum
        statusesEnum
        floorNumber
        surface
        livingSurface
        netFloorSurface
        hasMainStorage
      }
      contractDetails {
        currency
        rent
        totalMonthlyRent
        parkingRent
        deposit
        heatingCostsIncluded
        utilityCosts
        heatingCosts
        petsAllowed
        displayAmount
        hasCommission
        commission
        commissionNote
        commissionType
      }
    }
  }
```

**Variables:**

You can used any variable in `ListingFilter` to&#x20;

```
{
  "listingId": "fce90f3a-b8e4-4bc6-b6c0-2539acef5cdc",
  "propertyId": "e7cde0a1-9708-4fce-b36e-d8b8bcaa695f",
  "isActive": true,
  "isArchived": false,
  "fullSearch": "Hermannstrasse"
}
```

Should l be something like this.<br>

![](https://1594188794-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgL3i0-8YP9K1HyrHy8%2Fuploads%2FuVGik3Cbkms4zhuqOGcr%2FScreenshot%202022-06-20%20at%205.04.30%20PM.png?alt=media\&token=a4bd64fd-5143-4a9b-acba-8162ea5c7277)
{% endtab %}

{% tab title="CURL" %}

```shell
curl --location --request POST 'https://acme.everreal.co/api/reporting/graphql' \
--header 'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2ZTdhZmRlOC0xODFjLTQyNzUtYjY1NC1lNmJmZTZiMTZhZWIiLCJzdWIiOiI0MTQ2OWVjMS0yMjkzLTRjMjMtYWVmNy1lZjA4YzBkZTU0ZjEiLCJleHAiOjE2NTU3Mjc2NDEsImlhdCI6MTY1NTcyNDA0MX0.VbA7zl36QrIxRdFVKPluKC0PGrvS_4IFcWUajVQQLfDR6fsXArD8Q83btZ6Fz1UUjloRjFMmfugtIvDIRF1TvQBnDJFyx5568tpDg-H5nSRQ0iQ0fv8mRIGQWdigkXozo2FjHYO1alzU44GVcRx4JxABclexeDjKqeRklr5Gbb-z4fa_jbnMfB4z9mCK0nmy08igMzAB6Zgy0-yHuMpj6aXU-GNL1ti50sDVgNiQRDXUEZN2vor1S9c3sUYA521vBkszvWEXRgM_2ndV8sR8L-Tsma331ojL3PvEm1UNGjVj_yE6RhHIqdwxF7KsqhiUHjFKzgESLSOl3yIUTE10uw' \
--header 'Content-Type: application/json' \
--header 'Cookie: accept-language=en-US' \
--data-raw '{"query":"  query listingsQuery(\n    $from: Date\n    $to: Date\n    $companyId: String\n    $propertyId: String\n    $propertyGroupId: String\n    $ownerId: String\n    $listingId: String\n    $isArchived: Boolean\n    $isActive: Boolean\n    $fullSearch: String\n  ) {\n    listings(\n      input: {\n        paging: { take: 100, skip: 0 }\n        filter: {\n          from: $from\n          to: $to\n          companyId: $companyId\n          propertyGroupId: $propertyGroupId\n          propertyId: $propertyId\n          ownerId: $ownerId\n          listingId: $listingId\n          isArchived: $isArchived\n          isActive: $isActive\n          fullSearch: $fullSearch\n        }\n      }\n    ) {\n      id\n      title\n      type\n      isArchived\n      isActive\n      companyId\n      coverPicture {\n            name\n            resourceId\n            resourcePath\n            size\n            type\n            order\n            isCoverPicture\n      }\n      pictures  {\n            name\n            resourceId\n            resourcePath\n            size\n            type\n            order\n            isCoverPicture\n      }\n      documents   {\n            name\n            resourceId\n            resourcePath\n            size\n            type\n            order\n            isCoverPicture\n      }\n      floorplans  {\n            name\n            resourceId\n            resourcePath\n            size\n            type\n            order\n            isCoverPicture\n      }\n      property {\n        id\n        objectId\n        name\n        category\n        subtype\n        type\n        ownershipType\n        fullAddress\n      }\n      unit {\n           id\n            objectId\n            name\n            category\n            type\n            subtype\n            leasingStatusEnum\n            leasingStatusesEnum\n            statusesEnum\n            floorNumber\n            surface\n            livingSurface\n            netFloorSurface\n            hasMainStorage\n      }\n      contractDetails {\n        currency\n        rent\n        totalMonthlyRent\n        parkingRent\n        deposit\n        heatingCostsIncluded\n        utilityCosts\n        heatingCosts\n        petsAllowed\n        displayAmount\n        hasCommission\n        commission\n        commissionNote\n        commissionType\n      }\n    }\n  }","variables":{"listingId":"fce90f3a-b8e4-4bc6-b6c0-2539acef5cdc","propertyId":"e7cde0a1-9708-4fce-b36e-d8b8bcaa695f","isActive":true,"isArchived":false,"fullSearch":"Hermannstrasse"}}'
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("authorization", "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2ZTdhZmRlOC0xODFjLTQyNzUtYjY1NC1lNmJmZTZiMTZhZWIiLCJzdWIiOiI0MTQ2OWVjMS0yMjkzLTRjMjMtYWVmNy1lZjA4YzBkZTU0ZjEiLCJleHAiOjE2NTU3Mjc2NDEsImlhdCI6MTY1NTcyNDA0MX0.VbA7zl36QrIxRdFVKPluKC0PGrvS_4IFcWUajVQQLfDR6fsXArD8Q83btZ6Fz1UUjloRjFMmfugtIvDIRF1TvQBnDJFyx5568tpDg-H5nSRQ0iQ0fv8mRIGQWdigkXozo2FjHYO1alzU44GVcRx4JxABclexeDjKqeRklr5Gbb-z4fa_jbnMfB4z9mCK0nmy08igMzAB6Zgy0-yHuMpj6aXU-GNL1ti50sDVgNiQRDXUEZN2vor1S9c3sUYA521vBkszvWEXRgM_2ndV8sR8L-Tsma331ojL3PvEm1UNGjVj_yE6RhHIqdwxF7KsqhiUHjFKzgESLSOl3yIUTE10uw");
myHeaders.append("Content-Type", "application/json");

var graphql = JSON.stringify({
  query: "  query listingsQuery(\n    $from: Date\n    $to: Date\n    $companyId: String\n    $propertyId: String\n    $propertyGroupId: String\n    $ownerId: String\n    $listingId: String\n    $isArchived: Boolean\n    $isActive: Boolean\n    $fullSearch: String\n  ) {\n    listings(\n      input: {\n        paging: { take: 100, skip: 0 }\n        filter: {\n          from: $from\n          to: $to\n          companyId: $companyId\n          propertyGroupId: $propertyGroupId\n          propertyId: $propertyId\n          ownerId: $ownerId\n          listingId: $listingId\n          isArchived: $isArchived\n          isActive: $isActive\n          fullSearch: $fullSearch\n        }\n      }\n    ) {\n      id\n      title\n      type\n      isArchived\n      isActive\n      companyId\n      coverPicture {\n            name\n            resourceId\n            resourcePath\n            size\n            type\n            order\n            isCoverPicture\n      }\n      pictures  {\n            name\n            resourceId\n            resourcePath\n            size\n            type\n            order\n            isCoverPicture\n      }\n      documents   {\n            name\n            resourceId\n            resourcePath\n            size\n            type\n            order\n            isCoverPicture\n      }\n      floorplans  {\n            name\n            resourceId\n            resourcePath\n            size\n            type\n            order\n            isCoverPicture\n      }\n      property {\n        id\n        objectId\n        name\n        category\n        subtype\n        type\n        ownershipType\n        fullAddress\n      }\n      unit {\n           id\n            objectId\n            name\n            category\n            type\n            subtype\n            leasingStatusEnum\n            leasingStatusesEnum\n            statusesEnum\n            floorNumber\n            surface\n            livingSurface\n            netFloorSurface\n            hasMainStorage\n      }\n      contractDetails {\n        currency\n        rent\n        totalMonthlyRent\n        parkingRent\n        deposit\n        heatingCostsIncluded\n        utilityCosts\n        heatingCosts\n        petsAllowed\n        displayAmount\n        hasCommission\n        commission\n        commissionNote\n        commissionType\n      }\n    }\n  }",
  variables: {"listingId":"fce90f3a-b8e4-4bc6-b6c0-2539acef5cdc","propertyId":"e7cde0a1-9708-4fce-b36e-d8b8bcaa695f","isActive":true,"isArchived":false,"fullSearch":"Hermannstrasse"}
})
var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: graphql,
  redirect: 'follow'
};

fetch("https://acme.everreal.co/api/reporting/graphql", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}
{% endtabs %}

### Mutation

{% hint style="info" %}
Mutations are responsible to update a specific operations like activating, deactivating listing or archiving or unarchiving listing.
{% endhint %}

```typescript
type Mutation {
  updateListing(listing: ListingInput): Listing
}
```

Here are details on the capabilities of different mutations

* `updateListing`: Is used to perform update on an listing with the help of a listing Id, this will help is performing some basic operations listed below

### Schema Definition

```graphql
input ListingInput {
  id: String!
  action: LISTING_ACTIONS!
}

enum LISTING_ACTIONS {
  ACTIVATE_LISTING
  DEACTIVATE_LISTING
  ARCHIVE_LISTING
  UNARCHIVE_LISTING
}
```

Below we are providing a full example how to  update listing, all this information is not required, only the ones that was using **!** notation previously.

{% tabs %}
{% tab title="graphQL" %}

```graphql

mutation {
  updateListing(
    listing: {
      id: "42b751a6-3eb6-4e48-a0d1-8e9959151672"
      action: ACTIVATE_LISTING
    }
  ) {
    id
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl --location --request POST 'http://<subdomain>.everreal.co/api/reporting/graphql' \
--header 'Authorization: Bearer ....' \
--header 'Content-Type: application/json' \
--header 'Cookie: accept-language=de-DE' \
--data-raw '{"query":"\r\nmutation {\r\n  updateListing(\r\n    listing: {\r\n      id: \"42b751a6-3eb6-4e48-a0d1-8e9959151672\"\r\n      action: ACTIVATE_LISTING\r\n    }\r\n  ) {\r\n    id\r\n  }\r\n}","variables":{}}'
```

{% endtab %}

{% tab title="JavaScript" %}

```java
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer ....");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "accept-language=de-DE");

var graphql = JSON.stringify({
  query: "\r\nmutation {\r\n  updateListing(\r\n    listing: {\r\n      id: \"42b751a6-3eb6-4e48-a0d1-8e9959151670\"\r\n      action: ACTIVATE_LISTING\r\n    }\r\n  ) {\r\n    id\r\n  }\r\n}",
  variables: {}
})
var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: graphql,
  redirect: 'follow'
};

fetch("http://<subdomain>.everreal.co/api/reporting/graphql", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api-docs.everreal.co/endpoints/listing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
