Dokumentation för API-funktioner
POST House/{customerId} Metod för att skapa en villa
Request Information URI Parameters
NamnBeskrivningTypInformation
customerId Kund-id string Krävs
Body Parameters Villainformationen som ska uppdateras CmsHouse
NamnBeskrivningTypInformation
Plot Husets tomt CmsPlotInformation

BaseInformation Basinformation CmsHouseBaseInformation Basinformation krävs vid nyupplägg
Interior Interiör CmsHouseInterior

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

{
  "plot": {
    "area": 1.1
  },
  "baseInformation": {
    "livingSpace": 1.1,
    "otherSpace": 1.1,
    "propertyUnitDesignation": "sample string 1",
    "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"
      }
    ]
  },
  "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
}
<CmsHouse 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.House" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.Estate.Cms.House">
    <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 1</d2p1:PropertyUnitDesignation>
  </BaseInformation>
  <Description xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.Estate.Cms.House">
    <d2p1:LongSellingDescription>sample string 4</d2p1:LongSellingDescription>
    <d2p1:Other>sample string 5</d2p1:Other>
    <d2p1:SellPhrase>sample string 1</d2p1:SellPhrase>
    <d2p1:SellingHeading>sample string 2</d2p1:SellingHeading>
    <d2p1:ShortSellingDescription>sample string 3</d2p1:ShortSellingDescription>
  </Description>
  <Interests xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.Estate.Cms.House">
    <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.House" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.Estate.Cms.House">
    <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 xmlns:d3p1="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.Estate.Cms.Common">
      <d3p1:CmsRoom>
        <d3p1:Heading>sample string 1</d3p1:Heading>
        <d3p1:Text>sample string 2</d3p1:Text>
      </d3p1:CmsRoom>
      <d3p1:CmsRoom>
        <d3p1:Heading>sample string 1</d3p1:Heading>
        <d3p1:Text>sample string 2</d3p1:Text>
      </d3p1:CmsRoom>
    </d2p1:Rooms>
  </Interior>
  <Price xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Common" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.Estate.Cms.House">
    <d2p1:StartingPrice>1.1</d2p1:StartingPrice>
  </Price>
  <Sellers xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Express.Connect.Api.Models.Estate.Cms.House">
    <d2p1:string>sample string 1</d2p1:string>
    <d2p1:string>sample string 2</d2p1:string>
  </Sellers>
  <Plot xmlns:d2p1="http://schemas.datacontract.org/2004/07/Vitec.Housing.Connect.Api.Models.Estate.Cms.Common">
    <d2p1:Area>1.1</d2p1:Area>
  </Plot>
</CmsHouse>
Response Information Resource Description Metod för att skapa en villa
string Kodexempel

curl "https://connect.maklare.vitec.net/House/StringValue" -X POST -H "Content-Type: application/json" -H "Authorization: basic {Base64 kodad användarnamn och lösenord}" -d {\"plot\":{\"area\":0.0},\"baseInformation\":{\"livingSpace\":0.0,\"otherSpace\":0.0,\"propertyUnitDesignation\":\"StringValue\"},\"interior\":{\"numberOfRooms\":0.0,\"numberOfBedrooms\":0.0,\"maxNumberOfBedrooms\":0.0}}
            

$URL = "https://connect.maklare.vitec.net/House/StringValue"
$data = "{`"plot`":{`"area`":0.0},`"baseInformation`":{`"livingSpace`":0.0,`"otherSpace`":0.0,`"propertyUnitDesignation`":`"StringValue`"},`"interior`":{`"numberOfRooms`":0.0,`"numberOfBedrooms`":0.0,`"maxNumberOfBedrooms`":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 = "{\"plot\":{\"area\":0.0},\"baseInformation\":{\"livingSpace\":0.0,\"otherSpace\":0.0,\"propertyUnitDesignation\":\"StringValue\"},\"interior\":{\"numberOfRooms\":0.0,\"numberOfBedrooms\":0.0,\"maxNumberOfBedrooms\":0.0}}";
using (var response = await HttpClientInstance.PostAsync("House/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/House/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 = "{\"plot\":{\"area\":0.0},\"baseInformation\":{\"livingSpace\":0.0,\"otherSpace\":0.0,\"propertyUnitDesignation\":\"StringValue\"},\"interior\":{\"numberOfRooms\":0.0,\"numberOfBedrooms\":0.0,\"maxNumberOfBedrooms\":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
Testformulär Text input
Response Formats
"sample string 1"
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">sample string 1</string>