Search Api Docs

Search request

All fields are optional.
First page is 1 (not 0 indexed).
Default pageSize is 20.

"residence" is used when searching for residences.
"wish" is used when searching for residences that have a wish that matches the "wishObject".
You can exclude both to get "All" results.

Note that "orderBy" is an array with orderByObjects.
The ordering will work as "THEN BY" for each orderByObject.
POST: /search { "page": number?, "pageSize": number?, "swapTypes": number[]? // 11, 21, 12 "activity": searchConditionObject?, "residence": residenceObject?, "wish": wishObject?, "orderBy": orderByObject[]? }

ResidenceObject

All fields are optional:
{ "rooms": searchConditionObject?, "sqm": searchConditionObject?, "rent": searchConditionObject?, "floor": searchConditionObject?:, "isBecomingCondo": boolean?, "isCondo": boolean?, "hasBalcony": boolean?, "hasElevator": boolean?, "hasFireplace": boolean?, "hasBathtub": boolean?, "hasImage": boolean?, "freetext": string?, "geolocations": number[]? }

WishObject

All fields are optional:
{ "rooms": number?, "sqm": number?, "rent": number?, "geolocations": number[]? }

SearchConditionObject

An searchcondition object can be numeric for precise searches, or be a min / max object. When it's an min / max object, only 1 of them are required.
//Precise search "rent": 3000 // Min search "rent": { "min": 2000 }, // Max search "rent": { "max": 10000 } // Range search "rent": { "min": 4000, "max": 10000 }

OrderByObject

All fields are optional:
{ "key": string, "desc": boolean? } /* valid keys: 'propositionId', 'propositionNo', 'lastActive', 'userId', 'rooms', 'sqm', 'rent', 'floor', 'isBecomingCondo', 'isCondo', 'hasElevator', 'hasFireplace', 'hasBathtub', 'hasBalcony', 'hasImage', 'streetAddress', 'locality', */

Free text

The "freetext" field will search for matches in: "propositionNo" "streetAddress" "locality"
"freetext": "432233" // will find proposition with number 432233 "freetext": "oslogatan" // will find propositions with street address "oslogatan" "freetext": "stockholm" // will find propositions with stockholm in its localityname

Geolocations

The "geolocation" ids can be found in our geolocation API. Search API will return results matching ANY of the provided ids.
GET: https://geolocation.lagenhetsbyte.se/search/{searchString} Example: https://geolocation.lagenhetsbyte.se/search/lutha returns [{"id":38575,"type":"District","name":"Luthagen","description":"Uppsala","score":6}]

Response

// Response from POST: /search { "meta": { "page": number, "pageSize": number, "numPages": number, "numResults": number }, "results": propositionModel[] }

Proposition Model in response

{ "propositionId": string, "propositionNo": string, "swapType": string, "createdAt": string, "lastActive": string, "responseTimeHours": number, "residences": [ { "image": string, "rooms": number, "sqm": number, "rent": number, "floor": number, "streetAddress": string, "locality": string, "geolocations": number[], "coordinates": { "lat": number, "lng": number } } ] }

Example 1

This will search for residences that:
  • Have 3 rooms
  • Are at least 50 sqm
  • Have a rent less than 10000 kr/mån
  • Are located in Luthagen or Kungsholmen
And want to swap 1 on 1, or 2 on 1 The result will be ordered in propositionNo descending, then by hasImage descending
POST: /search { "page": 1, "swapTypes": [11, 21], "residence": { "rooms": 3, "sqm": { "min": 50 }, "rent": { "max": 10000 }, "geolocations": [38575, 37029] }, "orderBy": [ { "key": "propositionNo", "desc": true }, { "key": "hasImage", "desc": true } ] }

Example 2

This will search for residences that have a wish that matches a residence that:
  • Have 3 rooms
  • Is 50 sqm
  • Costs 10000 kr/mån
  • Is located in Luthagen or Kungsholmen
Order: Make sure that residences with images are shown first
POST: /search { "page": 1, "wish": { "rooms": 3, "sqm": 50, "rent": 10000, "geolocations": [38575, 37029] }, "orderBy": [ { "key": "hasImage", "desc": true } ] }

Example 3

This will search for residences that:
  • Have 3 rooms
  • Is at least 15 sqm
  • Costs less than 10000 kr/mån
  • Is located in Kungsholmen
And have a wish that matches a residence that:
  • Have 3 rooms
  • Is 80 sqm
  • Costs 12000
  • Is located in Luthagen
And have at least 3 activity stars.
POST: /search { "activity": { "min": 3, }, "residence": { "rooms": 3, "sqm": { "min": 15 }, "rent": { "max": 10000 }, "hasElevator": true, "geolocations": [ 37029 ] }, "wish": { "rooms": 3, "sqm": 80, "rent": 12000, "geolocations": [ 38575 ] } }

Search Coverage

Create a search coverage

All Search coverage endpoints needs an authenticated user.
POST: /coverage { "swapTypes": number[]? // 11, 21, 12 "residence": residenceObject?, "wish": wishObject? } ------------------------ "header": { "JWAUTH": token, // or "Cookie": `JWAUTH=${token}` }

Get user search coverages

GET: /coverage { "results": [ { "id": number, "createdAt": string, "body": thePostedSearchObject } ], "meta": {} }

Remove search coverages

DELETE: /coverage/{id}