Dokumentation för API-funktioner
POST Farm/{customerId} Metod för att skapa en gård.
Request Information URI Parameters
NamnBeskrivningTypInformation
customerId Kund-id string Krävs
Body Parameters Gårdsinformationen som ska uppdateras CmsFarm
NamnBeskrivningTypInformation
BaseInformation Basinformation CmsFarmBaseInformation Basinformation krävs vid nyupplägg
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

{
  "baseInformation": {
    "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"
    }
  },
  "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
}
<CmsFarm 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.Farm">
    <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:PropertyUnitDesignation>sample string 1</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>
  <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>
</CmsFarm>
Response Information Resource Description Metod för att skapa en gård.
string Kodexempel

curl "https://connect.maklare.vitec.net/Farm/StringValue" -X POST -H "Content-Type: application/json" -H "Authorization: basic {Base64 kodad användarnamn och lösenord}" -d {\"baseInformation\":{\"propertyUnitDesignation\":\"StringValue\",\"status\":0,\"address\":{\"municipality\":\"StringValue\",\"coordinate\":{\"longitud\":0.0,\"latitud\":0.0},\"streetAddress\":\"StringValue\"}},\"price\":{\"startingPrice\":0.0},\"sellers\":[\"StringValue\"]}
            

$URL = "https://connect.maklare.vitec.net/Farm/StringValue"
$data = "{`"baseInformation`":{`"propertyUnitDesignation`":`"StringValue`",`"status`":0,`"address`":{`"municipality`":`"StringValue`",`"coordinate`":{`"longitud`":0.0,`"latitud`":0.0},`"streetAddress`":`"StringValue`"}},`"price`":{`"startingPrice`":0.0},`"sellers`":[`"StringValue`"]}"
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\":{\"propertyUnitDesignation\":\"StringValue\",\"status\":0,\"address\":{\"municipality\":\"StringValue\",\"coordinate\":{\"longitud\":0.0,\"latitud\":0.0},\"streetAddress\":\"StringValue\"}},\"price\":{\"startingPrice\":0.0},\"sellers\":[\"StringValue\"]}";
using (var response = await HttpClientInstance.PostAsync("Farm/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/Farm/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\":{\"propertyUnitDesignation\":\"StringValue\",\"status\":0,\"address\":{\"municipality\":\"StringValue\",\"coordinate\":{\"longitud\":0.0,\"latitud\":0.0},\"streetAddress\":\"StringValue\"}},\"price\":{\"startingPrice\":0.0},\"sellers\":[\"StringValue\"]}";
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>