{ "baseInformation": { "livingSpace": 1.1, "otherSpace": 1.1, "propertyUnitDesignation": "sample string 2", "status": "AssignmentAttempt", "address": { "municipality": "sample string 1", "coordinate": { "longitud": 1.1, "latitud": 2.1 }, "streetAddress": "sample string 2", "zipCode": "sample string 3", "city": "sample string 4", "countryCode": "sample string 5" } }, "interior": { "numberOfRooms": 1.1, "numberOfBedrooms": 1.1, "maxNumberOfBedrooms": 1.1, "description": "sample string 1", "rooms": [ { "heading": "sample string 1", "text": "sample string 2" }, { "heading": "sample string 1", "text": "sample string 2" } ] }, "plot": { "area": 1.1 }, "price": { "startingPrice": 1.1 }, "sellers": [ "sample string 1", "sample string 2" ], "interests": [ "sample string 1", "sample string 2" ], "description": { "sellPhrase": "sample string 1", "sellingHeading": "sample string 2", "shortSellingDescription": "sample string 3", "longSellingDescription": "sample string 4", "other": "sample string 5" }, "userId": "sample string 1", "assignmentSourceId": 1 }
Dokumentation för API-funktioner
POST Cottage/{customerId}
Metod för att skapa ett fritidshus.
Request Information URI Parameters
Body Parameters
Fritidshusinformationen som ska sparas CmsCottage
Response Information
Resource Description
Metod för att skapa ett fritidshus.
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 | CmsCottageBaseInformation |
Basinformation krävs vid nyupplägg |
Interior | Interiör | CmsCottageInterior | |
Plot | Husets tomt | CmsPlotInformation | |
Price | Pris information | CmsPrice | |
Sellers | Lista över säljar id'n | Collection of string | |
Interests | Lista över intressenters id'n | Collection of string | |
Description | Beskrivning | Description | |
UserId | Användarid | string |
UserId krävs vid nyupplägg och uppdatering |
AssignmentSourceId | Intagskälla | integer |
Request Formats
<CmsCottage 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.Cottage"> <Address xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Common"> <City xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 4</City> <CountryCode xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 5</CountryCode> <StreetAddress xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 2</StreetAddress> <ZipCode xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models">sample string 3</ZipCode> <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> </Coordinate> <Municipality>sample string 1</Municipality> </Address> <Status xmlns="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Common">AssignmentAttempt</Status> <d2p1:LivingSpace>1.1</d2p1:LivingSpace> <d2p1:OtherSpace>1.1</d2p1:OtherSpace> <d2p1:PropertyUnitDesignation>sample string 2</d2p1:PropertyUnitDesignation> </BaseInformation> <Description> <LongSellingDescription>sample string 4</LongSellingDescription> <Other>sample string 5</Other> <SellPhrase>sample string 1</SellPhrase> <SellingHeading>sample string 2</SellingHeading> <ShortSellingDescription>sample string 3</ShortSellingDescription> </Description> <Interests xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:string>sample string 1</d2p1:string> <d2p1:string>sample string 2</d2p1:string> </Interests> <Interior xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Cottage"> <d2p1:Description>sample string 1</d2p1:Description> <d2p1:MaxNumberOfBedrooms>1.1</d2p1:MaxNumberOfBedrooms> <d2p1:NumberOfBedrooms>1.1</d2p1:NumberOfBedrooms> <d2p1:NumberOfRooms>1.1</d2p1:NumberOfRooms> <d2p1:Rooms> <d2p1:Room> <d2p1:Heading>sample string 1</d2p1:Heading> <d2p1:Text>sample string 2</d2p1:Text> </d2p1:Room> <d2p1:Room> <d2p1:Heading>sample string 1</d2p1:Heading> <d2p1:Text>sample string 2</d2p1:Text> </d2p1:Room> </d2p1:Rooms> </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 xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Common"> <d2p1:StartingPrice>1.1</d2p1:StartingPrice> </Price> <Sellers xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:string>sample string 1</d2p1:string> <d2p1:string>sample string 2</d2p1:string> </Sellers> </CmsCottage>
string Kodexempel
curl "https://connect.maklare.vitec.net/Cottage/StringValue" -X POST -H "Content-Type: application/json" -H "Authorization: basic {Base64 kodad användarnamn och lösenord}" -d {\"baseInformation\":{\"livingSpace\":0.0,\"otherSpace\":0.0,\"propertyUnitDesignation\":\"StringValue\"},\"interior\":{\"numberOfRooms\":0.0,\"numberOfBedrooms\":0.0,\"maxNumberOfBedrooms\":0.0},\"plot\":{\"area\":0.0}}
$URL = "https://connect.maklare.vitec.net/Cottage/StringValue"
$data = "{`"baseInformation`":{`"livingSpace`":0.0,`"otherSpace`":0.0,`"propertyUnitDesignation`":`"StringValue`"},`"interior`":{`"numberOfRooms`":0.0,`"numberOfBedrooms`":0.0,`"maxNumberOfBedrooms`":0.0},`"plot`":{`"area`":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\":{\"livingSpace\":0.0,\"otherSpace\":0.0,\"propertyUnitDesignation\":\"StringValue\"},\"interior\":{\"numberOfRooms\":0.0,\"numberOfBedrooms\":0.0,\"maxNumberOfBedrooms\":0.0},\"plot\":{\"area\":0.0}}";
using (var response = await HttpClientInstance.PostAsync("Cottage/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/Cottage/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\":{\"livingSpace\":0.0,\"otherSpace\":0.0,\"propertyUnitDesignation\":\"StringValue\"},\"interior\":{\"numberOfRooms\":0.0,\"numberOfBedrooms\":0.0,\"maxNumberOfBedrooms\":0.0},\"plot\":{\"area\":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>