Search requestAll 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[]?
}
|
ResidenceObjectAll 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[]?
}
|
WishObjectAll fields are optional: |
{
"rooms": number?,
"sqm": number?,
"rent": number?,
"geolocations": number[]?
}
|
SearchConditionObjectAn 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
}
|
OrderByObjectAll 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 textThe "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
|
GeolocationsThe "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 1This will search for residences that:
|
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 2This will search for residences that have a wish that matches a residence that:
|
POST: /search
{
"page": 1,
"wish": {
"rooms": 3,
"sqm": 50,
"rent": 10000,
"geolocations": [38575, 37029]
},
"orderBy": [
{
"key": "hasImage",
"desc": true
}
]
}
|
Example 3This will search for residences that:
|
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
]
}
}
|
Create a search coverageAll 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}
|