{ "baseInformation": { "newConstruction": true, "disposalForm": "Freehold", "possibleAccessDate": "sample string 1", "status": "ForSale", "estateType": "House", "address": { "province": "sample string 1", "coordinate": { "longitud": 1.1, "latitud": 2.1 }, "town": "sample string 2", "areaId": "sample string 3", "streetAddress": "sample string 4", "zipCode": "sample string 5", "city": "sample string 6", "countryCode": "sample string 7" }, "referenceId": "sample string 2" }, "interior": { "livingarea": 1.1, "buildingArea": 1.1, "numberOfRooms": 1.1, "numberOfBedrooms": { "min": 1.1, "max": 1.1 }, "numberOfBathrooms": 1 }, "price": { "swedishStartingPrice": 1.1, "startingPrice": 1.1 }, "descriptions": [ { "sellPhrase": "sample string 1", "sellingHeading": "sample string 2", "shortSellingDescription": "sample string 3", "longSellingDescription": "sample string 4", "interiorDescription": "sample string 5", "language": "sample string 6" }, { "sellPhrase": "sample string 1", "sellingHeading": "sample string 2", "shortSellingDescription": "sample string 3", "longSellingDescription": "sample string 4", "interiorDescription": "sample string 5", "language": "sample string 6" } ], "energyDeclaration": { "status": "NotSelected", "energyDeclarationDate": "2024-11-21T05:58:02.7611546+01:00", "energyConsumption": 1.1, "energyClass": "None" }, "plot": { "area": 1.1 }, "exterior": { "pool": true, "descriptionOfPool": "sample string 1", "terrace": true, "terraceSurface": 1, "balcony": true, "balconySurface": 1, "descriptionTerraceAndBalcony": "sample string 2" }, "distance": { "shoppingCentre": 1, "centre": 1, "airport": 1, "golfCource": 1, "sea": 1, "supermarket": 1, "pool": 1, "hospital": 1, "beach": 1 }, "currency": { "exchangeRate": "sample string 1", "currencyCode": "sample string 2" }, "userId": "sample string 1", "assignmentSourceId": 1 }
Dokumentation för API-funktioner
POST ForeignProperty/{customerId}
Metod för att skapa ett utlandsobjekt.
Request Information URI Parameters
Body Parameters
Informationen som ska uppdateras CmsForeignProperty
Response Information
Resource Description
Metod för att skapa ett utlandsobjekt.
string Kodexempel
Testformulär
Text input
Response Formats
Request Information URI Parameters
Namn | Beskrivning | Typ | Information |
customerId | Kund-id | string |
Krävs |
Namn | Beskrivning | Typ | Information |
BaseInformation | Basinformation | CmsForeignPropertyBaseInformation |
Basinformation krävs vid nyupplägg |
Interior | Interiör | CmsForeignPropertyInterior | |
Price | Pris information | CmsForeignPropertyPrice | |
Descriptions | Beskrivningar | Collection of ForeignPropertyDescription | |
EnergyDeclaration | Energideklatation | EnergyDeclaration | |
Plot | Tomt | CmsPlotInformation | |
Exterior | Exteriör | Exterior | |
Distance | Avstånd | Distance | |
Currency | Valuta | Currency | |
UserId | Användarid | string |
UserId krävs vid nyupplägg och uppdatering |
AssignmentSourceId | Intagskälla | integer |
Request Formats
<CmsForeignProperty xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms"> <AssignmentSourceId xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Common">1</AssignmentSourceId> <UserId xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Common">sample string 1</UserId> <BaseInformation xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.ForeignProperty"> <d2p1:Address> <City xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 6</City> <CountryCode xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 7</CountryCode> <StreetAddress xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 4</StreetAddress> <ZipCode xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 5</ZipCode> <d2p1:AreaId>sample string 3</d2p1:AreaId> <d2p1:Coordinate xmlns:d4p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models"> <d4p1:Latitud>2.1</d4p1:Latitud> <d4p1:Longitud>1.1</d4p1:Longitud> </d2p1:Coordinate> <d2p1:Province>sample string 1</d2p1:Province> <d2p1:Town>sample string 2</d2p1:Town> </d2p1:Address> <d2p1:DisposalForm>Freehold</d2p1:DisposalForm> <d2p1:EstateType>House</d2p1:EstateType> <d2p1:NewConstruction>true</d2p1:NewConstruction> <d2p1:PossibleAccessDate>sample string 1</d2p1:PossibleAccessDate> <d2p1:ReferenceId>sample string 2</d2p1:ReferenceId> <d2p1:Status>ForSale</d2p1:Status> </BaseInformation> <Currency> <CurrencyCode>sample string 2</CurrencyCode> <ExchangeRate>sample string 1</ExchangeRate> </Currency> <Descriptions xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.ForeignProperty"> <d2p1:ForeignPropertyDescription> <d2p1:InteriorDescription>sample string 5</d2p1:InteriorDescription> <d2p1:Language>sample string 6</d2p1:Language> <d2p1:LongSellingDescription>sample string 4</d2p1:LongSellingDescription> <d2p1:SellPhrase>sample string 1</d2p1:SellPhrase> <d2p1:SellingHeading>sample string 2</d2p1:SellingHeading> <d2p1:ShortSellingDescription>sample string 3</d2p1:ShortSellingDescription> </d2p1:ForeignPropertyDescription> <d2p1:ForeignPropertyDescription> <d2p1:InteriorDescription>sample string 5</d2p1:InteriorDescription> <d2p1:Language>sample string 6</d2p1:Language> <d2p1:LongSellingDescription>sample string 4</d2p1:LongSellingDescription> <d2p1:SellPhrase>sample string 1</d2p1:SellPhrase> <d2p1:SellingHeading>sample string 2</d2p1:SellingHeading> <d2p1:ShortSellingDescription>sample string 3</d2p1:ShortSellingDescription> </d2p1:ForeignPropertyDescription> </Descriptions> <Distance xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.ForeignPropertyInfo"> <d2p1:Airport>1</d2p1:Airport> <d2p1:Beach>1</d2p1:Beach> <d2p1:Centre>1</d2p1:Centre> <d2p1:GolfCource>1</d2p1:GolfCource> <d2p1:Hospital>1</d2p1:Hospital> <d2p1:Pool>1</d2p1:Pool> <d2p1:Sea>1</d2p1:Sea> <d2p1:ShoppingCentre>1</d2p1:ShoppingCentre> <d2p1:Supermarket>1</d2p1:Supermarket> </Distance> <EnergyDeclaration xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.ForeignProperty"> <d2p1:EnergyClass>None</d2p1:EnergyClass> <d2p1:EnergyConsumption>1.1</d2p1:EnergyConsumption> <d2p1:EnergyDeclarationDate>2024-11-21T05:58:02.7611546+01:00</d2p1:EnergyDeclarationDate> <d2p1:Status>NotSelected</d2p1:Status> </EnergyDeclaration> <Exterior xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.ForeignPropertyInfo"> <d2p1:Balcony>true</d2p1:Balcony> <d2p1:BalconySurface>1</d2p1:BalconySurface> <d2p1:DescriptionOfPool>sample string 1</d2p1:DescriptionOfPool> <d2p1:DescriptionTerraceAndBalcony>sample string 2</d2p1:DescriptionTerraceAndBalcony> <d2p1:Pool>true</d2p1:Pool> <d2p1:Terrace>true</d2p1:Terrace> <d2p1:TerraceSurface>1</d2p1:TerraceSurface> </Exterior> <Interior xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.ForeignProperty"> <d2p1:BuildingArea>1.1</d2p1:BuildingArea> <d2p1:Livingarea>1.1</d2p1:Livingarea> <d2p1:NumberOfBathrooms>1</d2p1:NumberOfBathrooms> <d2p1:NumberOfBedrooms xmlns:d3p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate"> <d3p1:Max>1.1</d3p1:Max> <d3p1:Min>1.1</d3p1:Min> </d2p1:NumberOfBedrooms> <d2p1:NumberOfRooms>1.1</d2p1:NumberOfRooms> </Interior> <Plot xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Common"> <d2p1:Area>1.1</d2p1:Area> </Plot> <Price> <StartingPrice xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Common">1.1</StartingPrice> <SwedishStartingPrice>1.1</SwedishStartingPrice> </Price> </CmsForeignProperty>
string Kodexempel
curl "https://connect.maklare.vitec.net/ForeignProperty/StringValue" -X POST -H "Content-Type: application/json" -H "Authorization: basic {Base64 kodad användarnamn och lösenord}" -d {\"baseInformation\":{\"newConstruction\":false,\"disposalForm\":0,\"possibleAccessDate\":\"StringValue\"},\"interior\":{\"livingarea\":0.0,\"buildingArea\":0.0,\"numberOfRooms\":0.0},\"price\":{\"swedishStartingPrice\":0.0,\"startingPrice\":0.0}}
$URL = "https://connect.maklare.vitec.net/ForeignProperty/StringValue"
$data = "{`"baseInformation`":{`"newConstruction`":false,`"disposalForm`":0,`"possibleAccessDate`":`"StringValue`"},`"interior`":{`"livingarea`":0.0,`"buildingArea`":0.0,`"numberOfRooms`":0.0},`"price`":{`"swedishStartingPrice`":0.0,`"startingPrice`":0.0}}"
Invoke-WebRequest -Uri $URL -Method POST -Headers @{"Content-Type" = "application/json"; "authorization" = "basic {Base64 kodad användarnamn och lösenord}"} -Body $data
// HttpClientInstance ska deklareras som en singleton
// public static readonly HttpClient HttpClientInstance = new HttpClient {
// BaseAddress = new Uri("https://connect.maklare.vitec.net"),
// DefaultRequestHeaders = {
// Authorization = new AuthenticationHeaderValue("Basic", "{Base64 kodad användarnamn och lösenord}")
// }
// }
var json = "{\"baseInformation\":{\"newConstruction\":false,\"disposalForm\":0,\"possibleAccessDate\":\"StringValue\"},\"interior\":{\"livingarea\":0.0,\"buildingArea\":0.0,\"numberOfRooms\":0.0},\"price\":{\"swedishStartingPrice\":0.0,\"startingPrice\":0.0}}";
using (var response = await HttpClientInstance.PostAsync("ForeignProperty/StringValue", new StringContent(json, Encoding.UTF8, "application/json"))) {
if (response.StatusCode == HttpStatusCode.Unauthorized) {
// Authorization headern är inte korrekt
}
if (response.StatusCode == HttpStatusCode.Forbidden) {
// Begärt data som det saknas åtkomst till
}
if (response.StatusCode == HttpStatusCode.InternalServerError) {
// Oväntat fel, kontakta Vitec
}
if (response.StatusCode == HttpStatusCode.BadRequest) {
var json = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<dynamic>(json);
// Hantera valideringsfel, presenteras i resultatet
}
var json = await response.Content.ReadAsStringAsync();
// JsonConvert finns i biblioteket Newtonsoft.Json
var result = JsonConvert.DeserializeObject<dynamic>(json);
// TODO: Gör något med resultatet
}
$URL = "https://connect.maklare.vitec.net/ForeignProperty/StringValue";
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERNAME, "{Användarnamn}");
curl_setopt($ch, CURLOPT_PASSWORD, "{Lösenord}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $URL);
$data = "{\"baseInformation\":{\"newConstruction\":false,\"disposalForm\":0,\"possibleAccessDate\":\"StringValue\"},\"interior\":{\"livingarea\":0.0,\"buildingArea\":0.0,\"numberOfRooms\":0.0},\"price\":{\"swedishStartingPrice\":0.0,\"startingPrice\":0.0}}";
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data)
));
$result = curl_exec($ch);
if (curl_errno($ch)) {
die(curl_getinfo($ch));
}
$info = curl_getinfo($ch);
curl_close($ch);
$http_code = $info["http_code"];
if ($http_code == 401) {
// Användarnamnet eller lösenordet är felaktigt
}
if ($http_code == 403) {
// Begärt data som det saknas åtkomst till
}
if ($http_code == 500) {
// Oväntat fel, kontakta Vitec
}
if ($http_code == 400) {
$json = json_decode($result, true);
// Hantera valideringsfel, presenteras i $json
}
// TODO: Gör något med resultatet
Resultat av begäran
"sample string 1"
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">sample string 1</string>